mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
fix(39836): allow type declaration/unknown type in catch arguments in JavaScript files (#42392)
This commit is contained in:
@@ -6279,6 +6279,7 @@ namespace ts {
|
||||
|
||||
function parseVariableDeclaration(allowExclamation?: boolean): VariableDeclaration {
|
||||
const pos = getNodePos();
|
||||
const hasJSDoc = hasPrecedingJSDocComment();
|
||||
const name = parseIdentifierOrPattern(Diagnostics.Private_identifiers_are_not_allowed_in_variable_declarations);
|
||||
let exclamationToken: ExclamationToken | undefined;
|
||||
if (allowExclamation && name.kind === SyntaxKind.Identifier &&
|
||||
@@ -6288,7 +6289,7 @@ namespace ts {
|
||||
const type = parseTypeAnnotation();
|
||||
const initializer = isInOrOfKeyword(token()) ? undefined : parseInitializer();
|
||||
const node = factory.createVariableDeclaration(name, exclamationToken, type, initializer);
|
||||
return finishNode(node, pos);
|
||||
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
||||
}
|
||||
|
||||
function parseVariableDeclarationList(inForStatementInitializer: boolean): VariableDeclarationList {
|
||||
|
||||
Reference in New Issue
Block a user