Repository navigation
Require declare before abstract in class declarations - #65360
Merged
Ryan Cavanaugh (RyanCavanaugh) merged 3 commits intoNov 6, 2026
Merged
Ryan Cavanaugh (RyanCavanaugh) merged 3 commits into
Ryan Cavanaugh (RyanCavanaugh) merged 3 commits into
Conversation
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix compiler accepting
Require Nov 6, 2026
abstract declare class syntaxdeclare before abstract in class declarations
Ryan Cavanaugh (RyanCavanaugh)
marked this pull request as ready for review
November 6, 2026 17:44
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change enforcing declare before abstract.
No open issues 🎉
What changed in this PR
Addresses #65356 by requiring declare to precede abstract in class declarations, using the compiler’s existing modifier-order diagnostic.
Changes:
- Report TS1029 for reversed modifiers while preserving the reparsed-node exception.
- Add regression coverage for both modifier orders in
.tsand.d.tsfiles, including exported declarations. - Add diagnostic, type, and symbol baselines.
| File | Description |
|---|---|
tsc/testdata/tests/cases/compiler/declareAbstractModifierOrder.ts |
Tests accepted and rejected modifier orders. |
tsc/testdata/baselines/reference/compiler/declareAbstractModifierOrder.types |
Records class type information. |
tsc/testdata/baselines/reference/compiler/declareAbstractModifierOrder.symbols |
Records class symbol information. |
tsc/testdata/baselines/reference/compiler/declareAbstractModifierOrder.errors.txt |
Records four expected TS1029 diagnostics. |
tsc/internal/checker/grammarchecks.go |
Enforces declare before abstract. |
Review effort: Balanced
Member
|
TypeScript Bot (@typescript-bot) test top999 |
Contributor
Contributor
|
Ryan Cavanaugh (@RyanCavanaugh) Here are the results of running the top 999 repos with tsc comparing Everything looks good! |
Ryan Cavanaugh (RyanCavanaugh)
approved these changes
Nov 6, 2026
Ryan Cavanaugh (RyanCavanaugh)
enabled auto-merge
November 6, 2026 21:32
Jake Bailey (jakebailey)
approved these changes
Nov 6, 2026
Ryan Cavanaugh (RyanCavanaugh)
deleted the
copilot/fix-abstract-declare-class-issue
branch
November 6, 2026 22:02
This was referenced Nov 6, 2026
graphite-app Bot
pushed a commit
to oxc-project/oxc
that referenced
this pull request
Nov 9, 2026
Reject `abstract declare` with TS1029 while preserving `declare abstract`, matching microsoft/TypeScript#65360. This applies to exported and unexported classes in `.ts` and `.d.ts` files, and to abstract properties.
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.
Fixes #65356
Analysis
Modifier-order validation omitted
declareafterabstract, allowing both orders for ambient class declarations.Fix
.tsand.d.tsfiles, including exported declarations.Copilot Checklist
I successfully ran the applicable command at the end of my session, and it completed without error:
abstract declare classas well asdeclare abstract class#65356