2018-10-09 19:38:46 +02:00
|
|
|
/// <reference path='fourslash.ts' />
|
|
|
|
|
|
|
|
// @allowJs: true
|
|
|
|
// @checkJs: true
|
|
|
|
// @noEmit: true
|
|
|
|
// @noImplicitAny: true
|
|
|
|
|
|
|
|
// @Filename: /promise.d.ts
|
|
|
|
////interface Promise<T> {
|
|
|
|
////}
|
|
|
|
////declare var Promise: Promise<any>;
|
|
|
|
|
|
|
|
// @Filename: /a.js
|
|
|
|
////export class D {}
|
|
|
|
////export default new D();
|
|
|
|
|
|
|
|
// @Filename: /b.js
|
|
|
|
////export class C {
|
|
|
|
//// set [|x|](val) { val; }
|
|
|
|
//// method() { this.x = import("./a"); }
|
|
|
|
////}
|
|
|
|
|
|
|
|
goTo.file("/b.js");
|
|
|
|
verify.codeFix({
|
2018-11-02 23:39:27 +01:00
|
|
|
index: 0,
|
2018-10-09 19:38:46 +02:00
|
|
|
description: "Infer type of 'x' from usage",
|
|
|
|
newFileContent:
|
|
|
|
`export class C {
|
|
|
|
/**
|
|
|
|
* @param {Promise<typeof import("./a")>} val
|
|
|
|
*/
|
|
|
|
set x(val) { val; }
|
|
|
|
method() { this.x = import("./a"); }
|
|
|
|
}`,
|
|
|
|
});
|
|
|
|
|