fix(transformer/typescript): panics when setPublicClassFields = true and the class includes private field#11089
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Instrumentation Performance ReportMerging #11089 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in the TypeScript transformer where the presence of private fields would cause a panic when setPublicClassFields is enabled. The changes ensure that private fields are skipped during transformation and update the relevant tests and snapshots accordingly.
- Updated tests to include private field syntax in both input and output fixtures.
- Modified the transformer logic in the TypeScript class file to skip processing private identifiers.
- Updated snapshots to reflect the new unresolved reference IDs behavior.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tasks/transform_conformance/tests/babel-plugin-transform-typescript/test/fixtures/use-define-for-class-fields-without-class-properties/output.js | Added private field syntax to verify transformer behavior for private fields. |
| tasks/transform_conformance/tests/babel-plugin-transform-typescript/test/fixtures/use-define-for-class-fields-without-class-properties/input.ts | Updated input syntax to include private fields for testing. |
| tasks/transform_conformance/snapshots/oxc.snap.md | Adjusted snapshot to match the new unresolved references output. |
| crates/oxc_transformer/src/typescript/class.rs | Modified transformation logic to skip private fields and updated unreachable error message. |
2dabcd6 to
a92ba99
Compare
Merge activity
|
a92ba99 to
d374490
Compare

close: #11084
We don't need to transform the private field, which is part of class-properties work, so
unreachableis expected. The bug is that we haven't skipped it.