File tree 1 file changed +12
-7
lines changed
1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -1351,13 +1351,18 @@ namespace ts {
1351
1351
return parent && !!findAncestor(initial, n => n === stopAt || isFunctionLike(n) ? "quit" : n === parent);
1352
1352
}
1353
1353
1354
- function getAnyImportSyntax(node: Node): AnyImportSyntax {
1355
- if (isAliasSymbolDeclaration(node)) {
1356
- if (node.kind === SyntaxKind.ImportEqualsDeclaration) {
1357
- return <ImportEqualsDeclaration>node;
1358
- }
1359
-
1360
- return findAncestor(node, isImportDeclaration);
1354
+ function getAnyImportSyntax(node: Node): AnyImportSyntax | undefined {
1355
+ switch (node.kind) {
1356
+ case SyntaxKind.ImportEqualsDeclaration:
1357
+ return node as ImportEqualsDeclaration;
1358
+ case SyntaxKind.ImportClause:
1359
+ return (node as ImportClause).parent;
1360
+ case SyntaxKind.NamespaceImport:
1361
+ return (node as NamespaceImport).parent.parent;
1362
+ case SyntaxKind.ImportSpecifier:
1363
+ return (node as ImportSpecifier).parent.parent.parent;
1364
+ default:
1365
+ return undefined;
1361
1366
}
1362
1367
}
1363
1368
You can’t perform that action at this time.
0 commit comments