Repository navigation
Update types for SourceFile.jsDoc and JSDocTypeDefTag.typeExpression - #65572
Merged
Andrew Branch (andrewbranch) merged 2 commits intoNov 19, 2026
Merged
Conversation
| { | ||
| "name": "TypeExpression", | ||
| "type": "Node", | ||
| "type": "TypeNode", |
There was a problem hiding this comment.
I think this can be stricter, JSDocTypeExpression | JSDocTypeLiteral
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the JSDoc API type refinements.
No open issues 🎉
1 file not reviewed
tsc/internal/ast/ast_generated.go: Generated file
What changed in this PR
Addresses #63877 by narrowing JSDoc properties in the TypeScript API while retaining Node as the parent type to accommodate parser recovery cases.
Changes:
- Types
Node.jsDocasreadonly JSDoc[]and typedeftypeExpressionasTypeNode. - Updates the AST schema, generators, and generated implementations consistently.
- Adds API tests for typedef variants, visitor and clone behavior, and factory type constraints.
| File | Description |
|---|---|
tsc/internal/ast/ast_generated.go |
Narrows typedef fields and factory parameters. |
tools/scripts/tsc/generate-encoder.ts |
Generates typed JSDoc accessors. |
tools/scripts/tsc/ast.json |
Defines typedef expressions as type nodes. |
packages/typescript/test/sync/ast.test.ts |
Tests narrowed contracts and removes an unnecessary cast. |
packages/typescript/src/ast/visitor.generated.ts |
Validates typedef children with isTypeNode. |
packages/typescript/src/ast/factory.generated.ts |
Narrows typedef factory parameters. |
packages/typescript/src/ast/ast.ts |
Narrows the base node’s JSDoc property. |
packages/typescript/src/ast/ast.generated.ts |
Narrows the typedef interface property. |
packages/typescript/src/api/node/node.generated.ts |
Exposes typed JSDoc arrays on remote nodes. |
Review effort: Balanced
Andrew Branch (andrewbranch)
requested a review
from Jake Bailey (jakebailey)
November 19, 2026 00:14
Andrew Branch (andrewbranch)
enabled auto-merge
November 19, 2026 00:18
Jake Bailey (jakebailey)
approved these changes
Nov 19, 2026
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 #63877
I took a look at
.parenttypes previously, doing some static analysis overast.json, and found a lot of cases (particularly in parser recovery and grammar errors) where Strada's.parenttype was a lie. We decided to keep itNodein the TS 7 API.