Skip to content

Print type arguments and end expression default exports with a semicolon - #84

Merged
NullVoxPopuli merged 1 commit into
NullVoxPopuli:mainfrom
NullVoxPopuli-ai-agent:nvp/print-type-arguments
Sep 4, 2026
Merged

NullVoxPopuli merged 1 commit into
NullVoxPopuli:mainfrom
NullVoxPopuli-ai-agent:nvp/print-type-arguments

Conversation

@NullVoxPopuli-ai-agent

Copy link
Copy Markdown
Contributor

Found while porting content-tag-utils/unprocess from jscodeshift to ember-estree. The round trip of export default template(...) satisfies TOC<{}> came back as export default <template>...</template> satisfies TOC.

Type arguments were dropped on print

oxc-parser and typescript-estree v8 store type arguments on typeArguments, and superTypeArguments on classes. print only read typeParameters, so these lost their <...>:

  • calls, new, and tagged templates
  • type references such as Array<string>
  • extends and implements clauses
  • satisfies, instantiation expressions, typeof x<Y>, and import('m').T<U>

printTypeArguments now reads typeArguments first and falls back to typeParameters for older parsers.

export default <expression> had no semicolon

export default x followed by a line that starts with ( or a backtick parses as a call. The printer now ends expression default exports with ;. Function and class declarations are unchanged.

Tests cover both cases with source round trips.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Fvnp457DHuZC4fBa2KCiqB

oxc-parser and typescript-estree v8 store type arguments on
`typeArguments` (and `superTypeArguments` on classes). The printer only
read `typeParameters`, so calls, `new`, type references, heritage
clauses, `satisfies`, and `typeof` lost their `<...>` on print. The
printer now reads `typeArguments` first and falls back to
`typeParameters` for older parsers. `TSImportType` reads `source` the
same way.

`export default <expression>` printed without a trailing semicolon. A
following line that starts with `(` or a backtick would then parse as a
call. Function and class declarations keep no semicolon.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fvnp457DHuZC4fBa2KCiqB
@NullVoxPopuli
NullVoxPopuli merged commit 7f4eb73 into NullVoxPopuli:main Sep 4, 2026
6 checks passed
@NullVoxPopuli
NullVoxPopuli deleted the nvp/print-type-arguments branch September 4, 2026 23:22
@github-actions github-actions Bot mentioned this pull request Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants