Skip to content

feat(parser): report invalid class definite assertions#23164

Merged
graphite-app[bot] merged 1 commit into
mainfrom
codex/parser-definite-property-contexts
Jun 9, 2026
Merged

feat(parser): report invalid class definite assertions#23164
graphite-app[bot] merged 1 commit into
mainfrom
codex/parser-definite-property-contexts

Conversation

@camc314

@camc314 camc314 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor
  • Match TypeScript’s diagnostic precedence for class property definite assignment assertions.
  • Report TS1264 when a class property uses ! without a type annotation.
  • Report TS1255 when a definite assignment assertion is used in disallowed class property contexts, including static.

@github-actions github-actions Bot added A-parser Area - Parser A-transformer Area - Transformer / Transpiler labels Jun 9, 2026
@camc314 camc314 marked this pull request as ready for review June 9, 2026 14:16
Copilot AI review requested due to automatic review settings June 9, 2026 14:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new TypeScript parser diagnostic to match tsc behavior for definite assignment assertions on class properties, and updates the repository’s conformance/coverage snapshots accordingly.

Changes:

  • Emit TS(1264) when a class property uses a definite assignment assertion (!) without a type annotation.
  • Emit TS(1255) for definite assignment assertions in disallowed contexts (now including static properties).
  • Update Babel transform conformance and parser/semantic coverage snapshots to reflect the new diagnostics and adjusted pass counts.

Reviewed changes

Copilot reviewed 2 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tasks/transform_conformance/snapshots/babel.snap.md Snapshot updated to include the newly-reported TS(1264) failure and adjusted pass totals.
tasks/coverage/snapshots/semantic_babel.snap Snapshot updated to reflect new semantic errors emitted for definite assignment assertions.
tasks/coverage/snapshots/parser_typescript.snap Snapshot updated with new TS(1264)/TS(1255) diagnostics and adjusted negative expectations.
tasks/coverage/snapshots/parser_babel.snap Snapshot updated to reflect new TS(1264) diagnostics affecting “Expect to Parse” fixtures.
crates/oxc_parser/src/js/class.rs Parser now reports TS(1264) for definite assertions without type annotations, and disallows definite assertions on static properties via TS(1255).

@camc314 camc314 force-pushed the codex/parser-definite-property-contexts branch from bc9a696 to 3f9c332 Compare June 9, 2026 14:21
@github-actions github-actions Bot added the A-linter Area - Linter label Jun 9, 2026
@codspeed-hq

codspeed-hq Bot commented Jun 9, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 4 improved benchmarks
❌ 1 regressed benchmark
✅ 57 untouched benchmarks
⏩ 9 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation pipeline[react.development.js] 4.7 ms 6.5 ms -27.01%
Simulation pipeline[binder.ts] 15.1 ms 13.4 ms +12.76%
Simulation pipeline[App.tsx] 38.5 ms 34.7 ms +10.94%
Simulation pipeline[RadixUIAdoptionSection.jsx] 352.6 µs 322.4 µs +9.37%
Simulation pipeline[kitchen-sink.tsx] 130.7 ms 120.7 ms +8.25%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing codex/parser-definite-property-contexts (f9d90a3) with codex/parser-definite-property-initializers (e3c8338)

Open in CodSpeed

Footnotes

  1. 9 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@camc314 camc314 force-pushed the codex/parser-definite-property-contexts branch from 3f9c332 to c5246ff Compare June 9, 2026 14:27

camc314 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of 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.

@camc314 camc314 force-pushed the codex/parser-definite-property-contexts branch from c5246ff to f9d90a3 Compare June 9, 2026 14:30
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Jun 9, 2026 — with Graphite App
@graphite-app

graphite-app Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Merge activity

- Match TypeScript’s diagnostic precedence for class property definite assignment assertions.
 - Report TS1264 when a class property uses ! without a type annotation.
 - Report TS1255 when a definite assignment assertion is used in disallowed class property contexts, including static.
@graphite-app graphite-app Bot force-pushed the codex/parser-definite-property-initializers branch from e3c8338 to 00244d8 Compare June 9, 2026 14:42
@graphite-app graphite-app Bot force-pushed the codex/parser-definite-property-contexts branch from f9d90a3 to d169fcd Compare June 9, 2026 14:43
Base automatically changed from codex/parser-definite-property-initializers to main June 9, 2026 14:47
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Jun 9, 2026
@graphite-app graphite-app Bot merged commit d169fcd into main Jun 9, 2026
32 checks passed
@graphite-app graphite-app Bot deleted the codex/parser-definite-property-contexts branch June 9, 2026 14:48
Boshen added a commit that referenced this pull request Jun 15, 2026
### 💥 BREAKING CHANGES

- 7a24911 codegen: [**BREAKING**] Borrow sourcemaps from codegen
(#23422) (Boshen)
- bb0ed44 transformer: [**BREAKING**] Disable styled-components
transpileTemplateLiterals by default (#23171) (Boshen)

### 🚀 Features

- 1490a0a linter/react: Implement react-compiler rule (#23202) (Boshen)
- 6c0bdf0 transformer/react-refresh: Support `module.property.useHook()`
(#23190) (Dunqing)
- 47991bd semantic: Report TS1228 for invalid type predicates (#23174)
(camc314)
- 1d3af58 parser: Add TS2398 parameter property diagnostic (#23216)
(camc314)
- 44313da semantic: Add `scope_is_descendant_of` api (#22313) (camc314)
- e5050c0 parser: Improve diagnostic for rest initializer (#23205)
(camc314)
- ec266bb transformer: Run React Compiler as a feature-gated transform
pass (#23201) (Boshen)
- e7374fe parser: Report error for `const` modifier on interface type
parameter (#23173) (camc314)
- a7c1c9b parser: Report ambient definite variable assertions (#23165)
(camc314)
- d169fcd parser: Report invalid class definite assertions (#23164)
(camc314)
- 00244d8 parser: Report definite property initializer errors (#23160)
(camc314)

### 🐛 Bug Fixes

- 52d0c31 transformer: Replace ambient dot defines (#23231) (camc314)
- 2c28748 transformer/class: Parent generated constructors to class
scope (#23222) (camc314)
- 8edd234 parser: Report accessor definite assertion on token (#23203)
(camc314)
- de38a3f react_compiler: Keep imports referenced only by a local
re-export (#23176) (Boshen)
- f5721c2 codegen: Preserve parentheses around `intrinsic` type
reference (#23156) (Boshen)
- e89f81d parser: Don't emit TS1477 for parenthesized instantiation
expression (#23147) (Boshen)
- 8a04149 parser: Reject module-referencing imports/exports in a
namespace body (#22829) (Boshen)

### ⚡ Performance

- 2783295 parser: Table-driven operator precedence lookup (#23346)
(Boshen)
- 231d5de parser: Single-match member expression dispatch (#23347)
(Boshen)
- e89729b codegen: Accept one-shot wrap closures (#23265) (camc314)
- a6c11fa parser: Force-inline read_non_decimal to fold per-digit number
dispatch (#23157) (Boshen)
- d74964c parser: Store class definite assertion offset (#23170)
(camc314)
- f0fda4d parser: Shrink-wrap cold diagnostic tails out of hot frames
(#23159) (Boshen)
- a082180 parser: Store definite assertion offset (#23167) (camc314)
- 534f9c6 oxc: Conditionally rebuild semantic in compiler pipeline
(#23153) (Boshen)
- b435c6a parser: Skip checkpoint for `infer T extends U` constraint in
disallow context (#23128) (Boshen)
- 7464dce parser: Peek instead of checkpoint/rewind for `export default`
modifier (#23124) (Boshen)
- 80a9a32 parser: Fast-path single-keyword TS declarations (#23083)
(Boshen)
- da1a6c6 diagnostics: Migrate to allocation-optimized oxc-miette
(#23094) (Boshen)
- b7b08ce parser: Peek once for the static modifier disambiguation
(#23079) (Boshen)
- e7e07a3 parser: Fold unary dispatch into a single match (#23076)
(Boshen)

### 📚 Documentation

- d241add semantic: Add `AGENTS.md` test guidance for agents (#23441)
(camc314)
- 026f1ae parser: Add `AGENTS.md` test guidance for agents (#23440)
(camc314)
- 09755ac transformer: Add `AGENTS.md` test guidance for agents (#23439)
(camc314)
- e6bdfd4 lexer: Correct reference link for `byte_handlers!` (#23313)
(Dunqing)
- 65b6d7a allocator: Fix memory leaks in `Arena` examples (#23257)
(overlookmotel)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter A-parser Area - Parser A-transformer Area - Transformer / Transpiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants