diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 1740bad2d3..d25bb3efd5 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2238,7 +2238,7 @@ namespace ts { isIdentifierOrPattern() || isModifierKind(token()) || token() === SyntaxKind.AtToken || - isStartOfType(/*disableLookahead*/ true); + isStartOfType(/*inStartOfParameter*/ true); } function parseParameter(): ParameterDeclaration { @@ -2699,7 +2699,7 @@ namespace ts { } } - function isStartOfType(disableLookahead?: boolean): boolean { + function isStartOfType(inStartOfParameter?: boolean): boolean { switch (token()) { case SyntaxKind.AnyKeyword: case SyntaxKind.StringKeyword: @@ -2729,11 +2729,11 @@ namespace ts { case SyntaxKind.DotDotDotToken: return true; case SyntaxKind.MinusToken: - return !disableLookahead && lookAhead(nextTokenIsNumericLiteral); + return !inStartOfParameter && lookAhead(nextTokenIsNumericLiteral); case SyntaxKind.OpenParenToken: // Only consider '(' the start of a type if followed by ')', '...', an identifier, a modifier, // or something that starts a type. We don't want to consider things like '(1)' a type. - return !disableLookahead && lookAhead(isStartOfParenthesizedOrFunctionType); + return !inStartOfParameter && lookAhead(isStartOfParenthesizedOrFunctionType); default: return isIdentifier(); }