Fix 'import a = A' case

This commit is contained in:
Paul van Brenk 2016-10-24 11:40:23 -07:00
parent 1f94e14d84
commit 409787495e
3 changed files with 6 additions and 3 deletions

View file

@ -91,8 +91,11 @@ namespace ts.codefix {
return removeSingleItem(elements, token);
}
// handle case where 'import a = A;'
// remove entire line
case SyntaxKind.ImportEqualsDeclaration:
return createCodeFix("{}", token.pos, token.end - token.pos);
const importDecl = token.parent;
return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos);
case SyntaxKind.EnumDeclaration:
return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos);

View file

@ -12,5 +12,5 @@
//// [|import a = A;|]
//// }
verify.codeFixAtPosition(" import {} = A;");
verify.codeFixAtPosition("");

View file

@ -17,4 +17,4 @@
////
//// }
verify.codeFixAtPosition("import {} = require('./file1')");
verify.codeFixAtPosition("");