Skip to content

Preserve < in getChildren() when type arguments begin with < - #64169

Open
Mateusz Burzyński (Andarist) wants to merge 3 commits into
microsoft:mainfrom
Andarist:fix-getchildren-less-than-token
Open

Preserve < in getChildren() when type arguments begin with <#64169
Mateusz Burzyński (Andarist) wants to merge 3 commits into
microsoft:mainfrom
Andarist:fix-getchildren-less-than-token

Conversation

@Andarist

Copy link
Copy Markdown
Contributor

fixes #64168

Copilot AI balanced review requested due to automatic review settings September 4, 2026 14:27
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Sep 4, 2026
@typescript-automation typescript-automation Bot added For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Sep 4, 2026

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.

🟢 Approval recommended

The targeted scanner correction matches parser behavior and is covered by focused regression tests.

Pull request overview

Fixes getChildren() dropping an opening < when adjacent type arguments begin with <.

Changes:

  • Rescans boundary-crossing << tokens as <.
  • Adds regression coverage for type references, calls, trivia, and shift expressions.
File summaries
File Description
packages/typescript/src/ast/astnav.ts Preserves split less-than tokens during child synthesis.
packages/typescript/test/sync/ast.test.ts Tests affected forms and guards ordinary shifts.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@typescript-automation typescript-automation Bot added For Backlog Bug PRs that fix a backlog bug and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Sep 4, 2026
const tokenEnd = scanner.getTokenEnd();
let token = scanner.getToken();
let tokenEnd = scanner.getTokenEnd();
if (token === SyntaxKind.LessThanLessThanToken && scanner.getTokenStart() < end && tokenEnd > end) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should a <<=, even if it's syntactically invalid, also needs to be accounted for?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

getChildren() drops the < token of a type argument list when immediately followed by another <

3 participants