Print remaining TS/V8 nodes; fix dropped enum members - #65
Merged
Conversation
Closes the printer's coverage gap against oxc-parser's + @glimmer/syntax's
visitor-key maps — every node type now has a case.
The notable fix is silent data loss: newer oxc nests enum members under a
`TSEnumBody` child, but `TSEnumDeclaration` read `node.members`, so every
enum printed empty (`enum Color {}`). Read members through `node.body`
(falling back to `node.members` for older oxc) and add a `TSEnumBody` case.
Also add the last unprinted nodes, which previously threw `unsupported
node type`:
- V8IntrinsicExpression — `%Name(args)`
- TSJSDocNullableType / TSJSDocNonNullableType — `?T` / `!T` (postfix flips)
- TSJSDocUnknownType — `?`
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
🏎️ Benchmark Comparison
Full mitata output |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the printer's coverage gap: diffing
print'scaselabels againstoxc-parser's +@glimmer/syntax's visitor-key maps (the same maps that generate the README node reference) showed every remaining node type is now handled.Notable fix — silent enum data loss
Newer oxc nests enum members under a
TSEnumBodychild, butTSEnumDeclarationreadnode.members, so every enum printed empty:No throw — members just vanished. Now read members through
node.body(falling back tonode.membersfor older oxc) and add aTSEnumBodycase.Remaining unprinted nodes (previously threw
unsupported node type)V8IntrinsicExpression→%Name(args)TSJSDocNullableType/TSJSDocNonNullableType→?T/!T(postfixflips toT?/T!)TSJSDocUnknownType→?These are exotic (V8 natives syntax; JSDoc-as-type), but handling them means the printer no longer throws on any node oxc/glimmer can emit.
Tests
print.test.js:TSEnumBody,TSEnumDeclarationwith a body, JSDoc types,V8IntrinsicExpression.parse-print-gts.test.js: parse→print enum (members preserved), via inline snapshots.oxlint+oxfmt --check+publintclean.🤖 Generated with Claude Code