Skip to content

test: lock in faithful printing of optional identifiers#143

Closed
baseballyama wants to merge 1 commit into
sveltejs:mainfrom
baseballyama:fix/optional-parameter-regression-test
Closed

test: lock in faithful printing of optional identifiers#143
baseballyama wants to merge 1 commit into
sveltejs:mainfrom
baseballyama:fix/optional-parameter-regression-test

Conversation

@baseballyama

Copy link
Copy Markdown
Member

close: #142

Add regression tests ensuring esrap preserves the ? on optional identifiers (introduced in #139), covering optional parameters with and without a type annotation. Documents that #142 was a Svelte-side issue (stale TS-only optional flag after stripping types), fixed in Svelte 5.56.4, not an esrap bug.

Since function a(disabled?) is valid in TypeScript, I believe the current behavior of esrap is correct.
https://www.typescriptlang.org/play/?noImplicitAny=false#code/GYVwdgxgLglg9mABAQwBQBMYGdkCMA2ApugPwCUiA3gFCJ2IQJZxEB0+cA5htnkemWoBfIA

Add regression tests ensuring esrap preserves the `?` on optional
identifiers (introduced in sveltejs#139), covering optional parameters with and
without a type annotation. Documents that sveltejs#142 was a Svelte-side issue
(stale TS-only `optional` flag after stripping types), fixed in Svelte
5.56.4, not an esrap bug.
@changeset-bot

changeset-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4870a06

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@baseballyama baseballyama deleted the fix/optional-parameter-regression-test branch June 24, 2026 05:13
@baseballyama

Copy link
Copy Markdown
Member Author

I found a similar test case.

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.

[PARSE_ERROR] Expected , or ) but found ?

1 participant