FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Handle JSDocParameterTag in ast.GetTypeAnnotationNode by auvred · Pull Request #64617 · microsoft/TypeScript · GitHub

Repository navigation

Handle JSDocParameterTag in ast.GetTypeAnnotationNode - #64617

Merged
Jake Bailey (jakebailey) merged 1 commit into
microsoft:mainfrom
auvred:fix-jsdoc-param-type-annotation
Oct 6, 2026
Merged

Jake Bailey (jakebailey) merged 1 commit into
microsoft:mainfrom
auvred:fix-jsdoc-param-type-annotation

Conversation

auvred commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

I just randomly noticed that GetTypeAnnotationNode calls Node.Type(), which handles both JSDoc parameter and property tags:

case KindJSDocParameterTag, KindJSDocPropertyTag:
return n.AsJSDocParameterOrPropertyTag().TypeExpression

but its own switch only includes property tags. So, for consistency, this function must have the parameter tag case missed in microsoft/typescript-go#900. No user-facing change, since the only caller doesn't pass JSDoc tags

// We don't want to complete using the type acquired by the shape
// of the binding pattern; we are only interested in types acquired
// through type declaration or inference.
// Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed -
// type of parameter will flow in from the contextual type of the function.
canGetType := ast.HasInitializer(rootDeclaration) ||
ast.GetTypeAnnotationNode(rootDeclaration) != nil ||
rootDeclaration.Parent.Parent.Kind == ast.KindForOfStatement

Copilot AI balanced review requested due to automatic review settings October 3, 2026 08:19
typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Oct 3, 2026
github-project-automation Bot moved this to Not started in PR Backlog Oct 3, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Copilot review overview

🟡 Changes recommended

The new AST utility behavior lacks a focused regression test.

Review effort: Balanced
Findings: 1

Open (1) What changed in this PR

Extends AST type annotation lookup to handle JSDoc parameter tags consistently.

Changes:

  • Adds KindJSDocParameterTag to GetTypeAnnotationNode.
File Description
tsc/​internal/​ast/​utilities.go Supports retrieving JSDoc parameter type expressions.

KindAsExpression, KindSatisfiesExpression, KindTypeAliasDeclaration, KindJSTypeAliasDeclaration,
KindNamedTupleMember, KindOptionalType, KindRestType, KindTemplateLiteralTypeSpan, KindJSDocTypeExpression,
KindJSDocPropertyTag, KindJSDocNullableType, KindJSDocNonNullableType, KindJSDocOptionalType:
KindJSDocParameterTag, KindJSDocPropertyTag, KindJSDocNullableType, KindJSDocNonNullableType, KindJSDocOptionalType:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

🫩

Jake Bailey (jakebailey) added this pull request to the merge queue Oct 6, 2026
Merged via the queue into microsoft:main with commit afd02f1 Oct 6, 2026
29 checks passed
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

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL