Microsoft/TypeScript
GitHub ã§èŠãExpected token errors should display all expected tokens, not just the first
Open
#43,467 opened on 2021幎3æ31æ¥
Effort: ModerateExperience EnhancementHelp Wanted
Repository metrics
- Stars
- Â (48,455 stars)
- PR merge metrics
-  (å¹³åããŒãž 6d 17h) (30d ã§ 9 merged PRs)
説æ
ð Version & Regression Information
Pretty sure this has been the behaviour since the rewrite.
⯠Playground Link
Playground link with relevant code
ð» Code
function a0([a, b, [[c]]]: [number, number, string[][]]) { }
a0([1, 2, [["world"]]);
ð Actual behavior
On the last ), "Expected ','."
ð Expected behavior
On the last ), "Expected ',' or ']'."
Right now the parser only shows the first error that starts at each location. This is an OK approach, especially when parsing has gone badly wrong, but often the parser will expect multiple tokens. The parser should report all the tokens in one error that were previously issued as multiple Expected_0 errors.