mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
fix(46433): forbid using keywords as parameter names (#46459)
This commit is contained in:
@@ -1164,6 +1164,10 @@
|
||||
"category": "Error",
|
||||
"code": 1389
|
||||
},
|
||||
"'{0}' is not allowed as a parameter name.": {
|
||||
"category": "Error",
|
||||
"code": 1390
|
||||
},
|
||||
"An import alias cannot use 'import type'": {
|
||||
"category": "Error",
|
||||
"code": 1392
|
||||
|
||||
@@ -2611,7 +2611,10 @@ namespace ts {
|
||||
case ParsingContext.ObjectLiteralMembers: return parseErrorAtCurrentToken(Diagnostics.Property_assignment_expected);
|
||||
case ParsingContext.ArrayLiteralMembers: return parseErrorAtCurrentToken(Diagnostics.Expression_or_comma_expected);
|
||||
case ParsingContext.JSDocParameters: return parseErrorAtCurrentToken(Diagnostics.Parameter_declaration_expected);
|
||||
case ParsingContext.Parameters: return parseErrorAtCurrentToken(Diagnostics.Parameter_declaration_expected);
|
||||
case ParsingContext.Parameters:
|
||||
return isKeyword(token())
|
||||
? parseErrorAtCurrentToken(Diagnostics._0_is_not_allowed_as_a_parameter_name, tokenToString(token()))
|
||||
: parseErrorAtCurrentToken(Diagnostics.Parameter_declaration_expected);
|
||||
case ParsingContext.TypeParameters: return parseErrorAtCurrentToken(Diagnostics.Type_parameter_declaration_expected);
|
||||
case ParsingContext.TypeArguments: return parseErrorAtCurrentToken(Diagnostics.Type_argument_expected);
|
||||
case ParsingContext.TupleElementTypes: return parseErrorAtCurrentToken(Diagnostics.Type_expected);
|
||||
|
||||
Reference in New Issue
Block a user