TypeScript/tests/cases/fourslash/codeFixInferFromUsageSetterWithInaccessibleType.ts
Nathan Shively-Sanders ca94d8efd9
Infer from usage better import types (#27626)
* Use host to improve SymbolTracker implementation

* inferFromUsage: Provide a better moduleResolverHost

This produces better paths on import types.
2018-10-09 07:12:09 -07:00

26 lines
528 B
TypeScript

/// <reference path='fourslash.ts' />
// @noImplicitAny: true
// @Filename: /a.ts
////export class D {}
////export default new D();
// @Filename: /b.ts
////export class C {
//// [|set x(val) { val; }|]
//// method() { this.x = import("./a"); }
////}
goTo.file("/b.ts");
verify.codeFix({
index: 0,
description: "Infer type of 'x' from usage",
newFileContent:
`export class C {
set x(val: Promise<typeof import("./a")>) { val; }
method() { this.x = import("./a"); }
}`,
});