convertImport

This commit is contained in:
Jesse Trinity
2020-05-29 12:41:18 -07:00
parent c3828ed086
commit 1efcffc915
+2 -2
View File
@@ -23,8 +23,8 @@ namespace ts.refactor {
const { file } = context;
const span = getRefactorContextSpan(context);
const token = getTokenAtPosition(file, span.start);
const importDecl = getParentNodeInSpan(token, file, span);
if (!importDecl || !isImportDeclaration(importDecl)) return undefined;
const importDecl = findAncestor(token, isImportDeclaration);
if (!importDecl || !isImportDeclaration(importDecl) || (importDecl.getEnd() < span.start + span.length)) return undefined;
const { importClause } = importDecl;
return importClause && importClause.namedBindings;
}