refactor(transformer/typescript): use exhaustive match#15711
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. |
There was a problem hiding this comment.
Pull Request Overview
This PR refactors a match statement on the Declaration enum to use exhaustive pattern matching instead of a catch-all pattern. This ensures compile-time errors if new Declaration variants are added in the future, preventing potential runtime misbehavior.
Key Changes:
- Refactored
FunctionDeclarationmatch arm from guard pattern to nested if statement - Replaced catch-all
_ => {}with explicitTSTypeAliasDeclaration | TSInterfaceDeclarationpattern - All 8 Declaration variants now explicitly matched
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CodSpeed Performance ReportMerging #15711 will not alter performanceComparing Summary
Footnotes
|
Merge activity
|
Pure refactor. Use an exhaustive match, so get a compilation error rather than misbehavior if we add a `Declaration` variant (I hit this problem in #15712).
ff4b9c8 to
c400e5e
Compare
…5711) Pure refactor. Use an exhaustive match, so get a compilation error rather than misbehavior if we add a `Declaration` variant (I hit this problem in oxc-project#15712).

Pure refactor. Use an exhaustive match, so get a compilation error rather than misbehavior if we add a
Declarationvariant (I hit this problem in #15712).