Skip to content

refactor(source-map): narrow internal traversal types - #102

Merged
luojiyin1987 merged 1 commit into
masterfrom
refactor/narrow-internal-traversal-types
Aug 15, 2026
Merged

refactor(source-map): narrow internal traversal types#102
luojiyin1987 merged 1 commit into
masterfrom
refactor/narrow-internal-traversal-types

Conversation

@luojiyin1987

Copy link
Copy Markdown
Contributor

What changed

  • Add a narrow TraversableNode structural type.
  • Type the post-parse index traversal with TraversableNode.
  • Add a small type guard for value and url fields.
  • Remove the position assertion from the traversal.

Why

The traversal used any for nodes owned by this project.

The new type documents the fields that traversal logic reads.

Scope

The upstream compiler boundary keeps its existing any types.

This change does not model undocumented micromark internals.

Impact

Runtime behavior and the public API do not change.

Validation

  • pnpm run lint
  • pnpm run build
  • pnpm test
  • pnpm exec tsc --noEmit

All 1,961 tests pass.

Use a structural node type and explicit string-field narrowing.

Keep upstream compiler internals typed as any.
@luojiyin1987
luojiyin1987 marked this pull request as ready for review August 15, 2026 03:39
@luojiyin1987
luojiyin1987 merged commit 8478fbe into master Aug 15, 2026
13 checks passed
@luojiyin1987
luojiyin1987 deleted the refactor/narrow-internal-traversal-types branch August 15, 2026 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant