fix(isolated-declarations): omit public accessor modifier#22880
Merged
Conversation
Contributor
Monitor Oxc
|
Merging this PR will not alter performance
Comparing Footnotes
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aligns accessor property .d.ts emission with existing property/method emission by normalizing away an explicit public accessibility modifier (so public is omitted in output, matching TypeScript’s emit behavior).
Changes:
- Apply
Self::transform_accessibilitywhen emittingClassElement::AccessorProperty, ensuringpublicis normalized toNone. - Add a fixture case (
public accessor i!: string) and update the snapshot to expectaccessor i: string;.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/oxc_isolated_declarations/src/class.rs | Normalizes accessor property accessibility via transform_accessibility so public is omitted in emitted declarations. |
| crates/oxc_isolated_declarations/tests/fixtures/set-get-accessor.ts | Adds a public accessor fixture input to cover the behavior change. |
| crates/oxc_isolated_declarations/tests/snapshots/set-get-accessor.snap | Updates expected .d.ts snapshot output to omit public for accessor properties. |
Dunqing
approved these changes
Jun 1, 2026
1a46116 to
a3ae099
Compare
Member
Merge activity
|
5cd031c to
97820a1
Compare
Accessor property declaration emit preserved an explicit `public` modifier because it passed `property.accessibility` through unchanged. Property and method declarations already normalize public accessibility away with `transform_accessibility`, so accessors should use the same path. This applies `Self::transform_accessibility` when emitting accessor properties and adds a fixture case for `public accessor i!: string`, which now snapshots as `accessor i: string;`. Stacked on #22878.
97820a1 to
070eb9e
Compare
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.
Accessor property declaration emit preserved an explicit
publicmodifier because it passedproperty.accessibilitythrough unchanged. Property and method declarations already normalize public accessibility away withtransform_accessibility, so accessors should use the same path.This applies
Self::transform_accessibilitywhen emitting accessor properties and adds a fixture case forpublic accessor i!: string, which now snapshots asaccessor i: string;.Stacked on #22878.