Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Point
✓ import type { Point } from 'micromark-util-types'
✗ import { Point } from 'micromark-util-types'
This package exports only TypeScript types; `import type` is essential. Attempting to import values will result in a runtime error or compilation failure.
State
✓ import type { State } from 'micromark-util-types'
✗ const { State } = require('micromark-util-types')
As an ESM-only package focused on types, CommonJS `require()` is not supported for importing these declarations.
TokenType
✓ import type { TokenType } from 'micromark-util-types'
✗ import TokenType from 'micromark-util-types'
There are no default exports. All types are named exports and must be imported explicitly using `import type { ... } from '...'`.
Demonstrates importing and utilizing key TypeScript types like `Code`, `State`, `Effects`, `TokenType`, `Point`, and `Token` to define functions for a custom micromark tokenizer extension.
import type {
Code,
State,
Effects,
TokenType,
Point,
Token
} from 'micromark-util-types';
// Example: A simple state function for a custom micromark extension
function factory(effects: Effects, ok: State, nok: State): State {
return start;
function start(code: Code): State | undefined {
// Implement custom parsing logic here
if (code === 91 /* `[` */) {
effects.enter('myCustomNode' as TokenType);
effects.consume(code);
return afterOpenBracket;
}
return nok(code);
}
function afterOpenBracket(code: Code): State | undefined {
if (code === 93 /* `]` */) {
effects.exit('myCustomNode' as TokenType);
effects.consume(code);
return ok;
}
return nok(code);
}
}
// This code snippet demonstrates how to leverage types from micromark-util-types
// within a custom micromark extension. The 'factory' function would be integrated
// into a micromark tokenizer. This file compiles but does not have a runtime effect
// as it's purely for type demonstration.
console.log('Micromark types loaded for extension development.');
Debug
Known issues
breakingThe `micromark-util-types@2` package is explicitly stated to be compatible with `micromark@3` and Node.js 16+. While the overall micromark monorepo is at version `4.x`, using `micromark-util-types@2` with `micromark@4` (or newer) might lead to type mismatches or runtime issues if API types have diverged. Always check for corresponding major versions of utility packages when updating the main `micromark` parser.fixConsult the `micromark` monorepo changelog or relevant package `README` for version compatibility. Upgrade `micromark-util-types` to a major version explicitly supporting your `micromark` core version, if available.
affects: >=2.0.0 (when used with micromark@4.0.0+)
gotchaThis package exports *only* TypeScript types and no runtime JavaScript code. Attempting to import any symbol without the `type` keyword (e.g., `import { Point } from '...'`) will lead to compilation errors in TypeScript or runtime errors if type-checking is bypassed, as there are no actual values to import.fixAlways use `import type { SymbolName } from 'micromark-util-types'` to correctly import type definitions. affects: >=1.0.0
breakingAs part of the unified collective, `micromark-util-types` adheres to Node.js LTS version compatibility. Major releases of micromark packages often drop support for unmaintained Node.js versions. `micromark-util-types@2` specifically targets Node.js 16+. Using it with older Node.js environments is not supported and may lead to unexpected behavior or crashes.fixEnsure your Node.js environment meets the minimum requirement (currently Node.js 16+ for `micromark-util-types@2`). Upgrade Node.js if necessary.
affects: <2.0.0 (or newer majors with older Node.js)
gotchaThe package is ESM-only. Direct `require()` statements in CommonJS modules will fail at runtime. Even with transpilation, the expectation is for `import` statements and an ESM context for proper operation.fixUse `import type` statements within an ESM context or a build setup that transpiles to ESM. If stuck in CommonJS, consider dynamic `import()` or review your project's module strategy.
affects: >=1.0.0
Errors
Common errors & fixes
Module 'micromark-util-types' has no exported member 'someValue'. Did you mean to use 'import type'?
Attempting to import a non-type value or a type without the `type` keyword from `micromark-util-types`, which only exports TypeScript types.
fixChange your import statement to `import type { someValue } from 'micromark-util-types'`. Cannot find module 'micromark-util-types' or its corresponding type declarations.
The package is not installed, or TypeScript is misconfigured and cannot locate the type declarations (e.g., `moduleResolution` settings, incorrect `baseUrl`, or an outdated `tsconfig.json`).
fixEnsure the package is installed: `npm install micromark-util-types`. Verify your `tsconfig.json` has appropriate `moduleResolution` (e.g., `node16` or `bundler`) and `typeRoots` settings. For older TypeScript versions, ensure compatibility with micromark's types.
TypeError: micromark_util_types_1.Point is not a constructor
This error occurs at runtime when a symbol imported from `micromark-util-types` is treated as a JavaScript value (e.g., a class or function) rather than a TypeScript type. This package provides no runtime code.
fixReview the code where `Point` (or other types from this package) is used. It should only appear in type annotations or declarations, never as a value in runnable JavaScript code. Ensure `import type` is used.
Audit
Dependencies
No dependency data recorded yet.