#64490·TypeScript

TypeScript 7.0.2 scanner does not advance on bare hash

Author: yum45fCreated Sep 28, 2026Updated Sep 28, 2026
LabelsUnactionable

Version

TypeScript 7.0.2

Reproduction

bash
npm install [email protected]
node --input-type=module -e 'import { createScanner, LanguageVariant, SyntaxKind } from "typescript/unstable/ast"; const scanner=createScanner(false,LanguageVariant.Standard,"#"); for(let i=0;i<2;i++){const token=scanner.scan(); console.log(SyntaxKind[token], scanner.getTokenStart(), scanner.getTokenEnd())}'

Actual output:

PrivateIdentifier 0 0
PrivateIdentifier 0 0

The scanner repeatedly returns the same non-EOF token without moving from offset 0. A loop that scans until EndOfFile therefore never terminates on a bare # (including when a later comment appears in the same source). Expected: scanning malformed input advances or returns EOF so consumers can terminate. A bare # followed by an identifier scans normally.