mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
fix(44466): Fixes parsing contextual keyword casts as arrow functions
This commit is contained in:
@@ -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 (lookAhead(() => nextToken() === SyntaxKind.AsKeyword)) {
|
||||
// https://github.com/microsoft/TypeScript/issues/44466
|
||||
return Tristate.False;
|
||||
}
|
||||
return Tristate.True;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
//// [overrideParenVariable.ts]
|
||||
|
||||
let override: any;
|
||||
export const a = (override as number);
|
||||
|
||||
//// [overrideParenVariable.js]
|
||||
|
||||
export const a = override;
|
||||
@@ -0,0 +1,5 @@
|
||||
//@target: ES5
|
||||
|
||||
let readonly: any;
|
||||
|
||||
export const a = (readonly as number);
|
||||
Reference in New Issue
Block a user