mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 22:32:33 -05:00
fix(45192): show implement interface QF for re-exported types (#45245)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
}`
|
||||
});
|
||||
Reference in New Issue
Block a user