Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/services/codefixes/importFixes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ namespace ts.codefix {
}

function getImportFixForSymbol(sourceFile: SourceFile, exportInfos: readonly SymbolExportInfo[], moduleSymbol: Symbol, symbolName: string, program: Program, position: number | undefined, preferTypeOnlyImport: boolean, useRequire: boolean, host: LanguageServiceHost, preferences: UserPreferences) {
Debug.assert(exportInfos.some(info => info.moduleSymbol === moduleSymbol), "Some exportInfo should match the specified moduleSymbol");
Debug.assert(exportInfos.some(info => info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol), "Some exportInfo should match the specified moduleSymbol");
return getBestFix(getImportFixes(exportInfos, symbolName, position, preferTypeOnlyImport, useRequire, program, sourceFile, host, preferences), sourceFile, program, host, preferences);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/// <reference path='fourslash.ts' />

// @Filename: node_modules/test-module/index.d.ts
////declare namespace e {
//// interface Foo {}
////}
////export = e;

// @Filename: a.ts
////import { Foo } from "test-module";
////export interface A {
//// foo(): Foo;
////}

// @Filename: b.ts
////import { A } from "./a";
////export class B implements A {}

goTo.file("b.ts");
verify.codeFix({
description: "Implement interface 'A'",
newFileContent:
`import { Foo } from "test-module";
import { A } from "./a";
export class B implements A {
foo(): Foo {
throw new Error("Method not implemented.");
}
}`
});