Repository navigation
Fix incorrect node type annotations - #65489
Open
Jake Bailey (jakebailey) wants to merge 4 commits into
Open
Jake Bailey (jakebailey) wants to merge 4 commits into
Jake Bailey (jakebailey) wants to merge 4 commits into
Conversation
The reuse helper also processes property names and type parameter declarations. A TypeNode annotation misrepresents these supported callers even though Go accepts the node aliases interchangeably.
Named evaluation transforms preserve the surrounding declaration kinds. Describing their results as expressions hides the contracts expected by their callers.
The type serializer checks arbitrary serialized expressions for generated-name metadata. Restricting this helper's annotation to identifiers misrepresents a supported caller.
Declaration names can be string literals, binding patterns, or computed names, and namespace member names are property accesses. Identifier result annotations misrepresent those node kinds even though Go accepts the node aliases interchangeably.
Jake Bailey (jakebailey)
requested review from
Andrew Branch (andrewbranch)
and
a balanced review from Copilot
November 13, 2026 22:52
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the AST node type annotation corrections.
No open issues 🎉
What changed in this PR
Corrects AST node type annotations in the native TypeScript compiler to match the nodes each helper accepts or returns. These alias-only changes leave runtime behavior unchanged.
Changes:
- Uses general node annotations for helpers that support multiple node kinds.
- Uses concrete return annotations for named-evaluation helpers and namespace member access.
| File | Description |
|---|---|
tsc/internal/transformers/utilities.go |
Allows the generated-identifier predicate to accept any node. |
tsc/internal/transformers/estransforms/namedevaluation.go |
Corrects helper return types and broadens the dispatcher’s return annotation. |
tsc/internal/printer/factory.go |
Broadens declaration-name annotations and identifies namespace member results as property access nodes. |
tsc/internal/checker/nodecopy.go |
Generalizes the node-reuse helper’s parameter and return annotations. |
Review effort: Balanced
This branch has not been deployed
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.
This came up in an audit; these type annotations are incorrect.