fix(39836): allow type declaration/unknown type in catch arguments in JavaScript files (#42392)

This commit is contained in:
Oleksandr T
2021-03-04 17:19:35 -08:00
committed by GitHub
parent 38fdce9440
commit ca8d9e4402
15 changed files with 619 additions and 12 deletions
+2 -1
View File
@@ -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 {