feat(semantic): add TS2309 error for export assignment with other exports#15992
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 Performance ReportMerging #15992 will not alter performanceComparing Summary
Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR implements TypeScript error TS2309, which detects when an export = statement is used in a module that also contains other exported elements. This is a semantic error in TypeScript because export = (CommonJS-style export) is incompatible with ES6-style exports.
Key Changes:
- Added semantic check for TS2309 that reports errors when
export =coexists with other exports in the same scope - Improved test coverage with 15 previously failing test cases now passing (from 57.17% to 57.76%)
- Implemented recursive checking for nested TypeScript module declarations
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
crates/oxc_semantic/src/checker/typescript.rs |
Implements the core logic for detecting export assignment conflicts, including helper functions for checking statements in programs and module declarations |
crates/oxc_semantic/src/checker/mod.rs |
Integrates the new check into the semantic analysis pipeline, calling it during Program node processing |
tasks/coverage/snapshots/parser_typescript.snap |
Updates test snapshots showing 15 additional negative test cases now correctly reporting TS2309 errors |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge activity
|
3748cbb to
f317b33
Compare
f317b33 to
307b964
Compare
…orts (#15992) Added TS2309 error check.
307b964 to
da87812
Compare
### 💥 BREAKING CHANGES - 083fea9 napi/parser: [**BREAKING**] Represent empty optional fields on JS side as `null` (#16411) (overlookmotel) ### 🚀 Features - 7a2afee parser: Add TS1174 error for classes extending multiple base classes (#15993) (sapphi-red) - da87812 semantic: Add TS2309 error for export assignment with other exports (#15992) (sapphi-red) - d6d2bcd minifier: Remove unused function calls that are marked by `manual_pure_functions` (#16534) (sapphi-red) - c90f053 minifier: Support `.` separated values for `compress.treeshake.manualPureFunctions` (#16529) (sapphi-red) - a607cc4 codegen: Preserve comments between CatchClause's param and body (#16167) (copilot-swe-agent) - 8c10694 semantic: Expose get_comment_at method (#16439) (camc314) - 3981e7a ast: Add get_comment_at to lookup a comment by span (#16438) (camc314) ### 🐛 Bug Fixes - 699406a napi/parser: Move `ExportEntry::module_request` field to first (#16412) (overlookmotel) - 12bd794 napi/parser: Move `ExportEntry::module_request` field to last (#16403) (overlookmotel) ### ⚡ Performance - 790beeb napi/parser: Do not remove extraneous options on JS side (#16447) (overlookmotel) Co-authored-by: Boshen <[email protected]>
### 💥 BREAKING CHANGES - 083fea9 napi/parser: [**BREAKING**] Represent empty optional fields on JS side as `null` (#16411) (overlookmotel) ### 🚀 Features - 7a2afee parser: Add TS1174 error for classes extending multiple base classes (#15993) (sapphi-red) - da87812 semantic: Add TS2309 error for export assignment with other exports (#15992) (sapphi-red) - d6d2bcd minifier: Remove unused function calls that are marked by `manual_pure_functions` (#16534) (sapphi-red) - c90f053 minifier: Support `.` separated values for `compress.treeshake.manualPureFunctions` (#16529) (sapphi-red) - a607cc4 codegen: Preserve comments between CatchClause's param and body (#16167) (copilot-swe-agent) - 8c10694 semantic: Expose get_comment_at method (#16439) (camc314) - 3981e7a ast: Add get_comment_at to lookup a comment by span (#16438) (camc314) ### 🐛 Bug Fixes - 699406a napi/parser: Move `ExportEntry::module_request` field to first (#16412) (overlookmotel) - 12bd794 napi/parser: Move `ExportEntry::module_request` field to last (#16403) (overlookmotel) ### ⚡ Performance - 790beeb napi/parser: Do not remove extraneous options on JS side (#16447) (overlookmotel) Co-authored-by: Boshen <[email protected]>
…orts (oxc-project#15992) Added TS2309 error check.
### 💥 BREAKING CHANGES - 083fea9 napi/parser: [**BREAKING**] Represent empty optional fields on JS side as `null` (oxc-project#16411) (overlookmotel) ### 🚀 Features - 7a2afee parser: Add TS1174 error for classes extending multiple base classes (oxc-project#15993) (sapphi-red) - da87812 semantic: Add TS2309 error for export assignment with other exports (oxc-project#15992) (sapphi-red) - d6d2bcd minifier: Remove unused function calls that are marked by `manual_pure_functions` (oxc-project#16534) (sapphi-red) - c90f053 minifier: Support `.` separated values for `compress.treeshake.manualPureFunctions` (oxc-project#16529) (sapphi-red) - a607cc4 codegen: Preserve comments between CatchClause's param and body (oxc-project#16167) (copilot-swe-agent) - 8c10694 semantic: Expose get_comment_at method (oxc-project#16439) (camc314) - 3981e7a ast: Add get_comment_at to lookup a comment by span (oxc-project#16438) (camc314) ### 🐛 Bug Fixes - 699406a napi/parser: Move `ExportEntry::module_request` field to first (oxc-project#16412) (overlookmotel) - 12bd794 napi/parser: Move `ExportEntry::module_request` field to last (oxc-project#16403) (overlookmotel) ### ⚡ Performance - 790beeb napi/parser: Do not remove extraneous options on JS side (oxc-project#16447) (overlookmotel) Co-authored-by: Boshen <[email protected]>

Added TS2309 error check.