mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 11:35:42 -06:00
Clean up
This commit is contained in:
parent
2f453ce674
commit
40c0cbd7b5
@ -80,14 +80,14 @@ namespace ts.codefix {
|
||||
|
||||
// handle case where 'import a = A;'
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
let importEquals = findImportDeclaration(token);
|
||||
const importEquals = findImportDeclaration(token);
|
||||
return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos);
|
||||
|
||||
case SyntaxKind.ImportSpecifier:
|
||||
const namedImports = <NamedImports>token.parent.parent;
|
||||
if (namedImports.elements.length === 1) {
|
||||
// Only 1 import and it is unused. So the entire declaration should be removed.
|
||||
let importSpec = findImportDeclaration(token);
|
||||
const importSpec = findImportDeclaration(token);
|
||||
return createCodeFix("", importSpec.pos, importSpec.end - importSpec.pos);
|
||||
}
|
||||
else {
|
||||
@ -108,10 +108,11 @@ namespace ts.codefix {
|
||||
|
||||
case SyntaxKind.NamespaceImport:
|
||||
const namespaceImport = <NamespaceImport>token.parent;
|
||||
if(namespaceImport.name == token && !(<ImportClause>namespaceImport.parent).name){
|
||||
if (namespaceImport.name == token && !(<ImportClause>namespaceImport.parent).name) {
|
||||
const importDecl = findImportDeclaration(namespaceImport);
|
||||
return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
const start = (<ImportClause>namespaceImport.parent).name.end;
|
||||
return createCodeFix("", start, (<ImportClause>namespaceImport.parent).namedBindings.end - start);
|
||||
}
|
||||
@ -163,20 +164,4 @@ namespace ts.codefix {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const s = "hello";
|
||||
|
||||
class C {
|
||||
|
||||
|
||||
|
||||
private ["string"]: string;
|
||||
private "b iz": string;
|
||||
|
||||
bar() {
|
||||
this
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
{
|
||||
"compilerOptions": {
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user