Skip to content

fix: print valid TypeScript for asserts predicates, qualified namespaces, and computed signature keys#137

Open
MathiasWP wants to merge 1 commit into
sveltejs:mainfrom
MathiasWP:fix/ts-token-emission
Open

fix: print valid TypeScript for asserts predicates, qualified namespaces, and computed signature keys#137
MathiasWP wants to merge 1 commit into
sveltejs:mainfrom
MathiasWP:fix/ts-token-emission

Conversation

@MathiasWP

Copy link
Copy Markdown
Contributor

Fixes three TypeScript constructs that esrap was printing as invalid output:

  • asserts type predicates were printed in the wrong order (asserts x is T became x asserts T)
  • qualified namespace/module names were mangled (namespace A.B.C became namespace Anamespace Bnamespace C)
  • computed keys in method/property signatures lost their brackets (interface I { [Symbol.iterator](): T } became Symbol.iterator(): T)

…ces, and computed signature keys

These were emitted as invalid output:

- asserts type predicates printed in the wrong order: asserts x is T -> x asserts T
- qualified namespace/module names mangled: namespace A.B.C ->
  namespace Anamespace Bnamespace C
- computed method/property signature keys lost their brackets:
  interface I { [Symbol.iterator](): T } -> Symbol.iterator(): T

Adds test/ts-token-emission.test.js.
@changeset-bot

changeset-bot Bot commented Jun 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e398da2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
esrap Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

guyutongxue added a commit to piovium/espolar that referenced this pull request Jun 3, 2026
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