Merge pull request #49029 from DavidSouther/fix/44466-contextual-keyword-assertion

fix(44466): Fixes parsing contextual keyword casts as arrow functions
This commit is contained in:
Daniel Rosenwasser
2022-05-10 16:37:49 -07:00
committed by GitHub
5 changed files with 112 additions and 0 deletions

View File

@@ -4538,6 +4538,10 @@ namespace ts {
// isn't actually allowed, but we want to treat it as a lambda so we can provide
// a good error message.
if (isModifierKind(second) && second !== SyntaxKind.AsyncKeyword && lookAhead(nextTokenIsIdentifier)) {
if (nextToken() === SyntaxKind.AsKeyword) {
// https://github.com/microsoft/TypeScript/issues/44466
return Tristate.False;
}
return Tristate.True;
}