Update baselines

This commit is contained in:
Kanchalai Tanglertsampan
2017-03-28 13:31:50 -07:00
parent 249f446212
commit f3306db91d
71 changed files with 3138 additions and 0 deletions
@@ -0,0 +1,27 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpression1ES2018.ts] ////
//// [0.ts]
export function foo() { return "foo"; }
//// [1.ts]
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
})
function foo() {
const p2 = import("./0");
}
//// [0.js]
export function foo() { return "foo"; }
//// [1.js]
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
function foo() {
const p2 = import("./0");
}
@@ -0,0 +1,28 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export function foo() { return "foo"; }
>foo : Symbol(foo, Decl(0.ts, 0, 0))
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
import("./0");
var p1 = import("./0");
>p1 : Symbol(p1, Decl(1.ts, 1, 3))
p1.then(zero => {
>p1.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p1 : Symbol(p1, Decl(1.ts, 1, 3))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>zero : Symbol(zero, Decl(1.ts, 2, 8))
return zero.foo();
>zero.foo : Symbol(foo, Decl(0.ts, 0, 0))
>zero : Symbol(zero, Decl(1.ts, 2, 8))
>foo : Symbol(foo, Decl(0.ts, 0, 0))
})
function foo() {
>foo : Symbol(foo, Decl(1.ts, 4, 2))
const p2 = import("./0");
>p2 : Symbol(p2, Decl(1.ts, 7, 9))
}
@@ -0,0 +1,39 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export function foo() { return "foo"; }
>foo : () => string
>"foo" : "foo"
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
import("./0");
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
var p1 = import("./0");
>p1 : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
p1.then(zero => {
>p1.then(zero => { return zero.foo();}) : Promise<string>
>p1.then : <TResult1 = typeof "tests/cases/conformance/es2018/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/es2018/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>p1 : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>then : <TResult1 = typeof "tests/cases/conformance/es2018/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/es2018/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>zero => { return zero.foo();} : (zero: typeof "tests/cases/conformance/es2018/dynamicImport/0") => string
>zero : typeof "tests/cases/conformance/es2018/dynamicImport/0"
return zero.foo();
>zero.foo() : string
>zero.foo : () => string
>zero : typeof "tests/cases/conformance/es2018/dynamicImport/0"
>foo : () => string
})
function foo() {
>foo : () => void
const p2 = import("./0");
>p2 : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
}
@@ -0,0 +1,29 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpression2ES2018.ts] ////
//// [0.ts]
export class B {
print() { return "I am B"}
}
//// [2.ts]
function foo(x: Promise<any>) {
x.then(value => {
let b = new value.B();
b.print();
})
}
foo(import("./0"));
//// [0.js]
export class B {
print() { return "I am B"; }
}
//// [2.js]
function foo(x) {
x.then(value => {
let b = new value.B();
b.print();
});
}
foo(import("./0"));
@@ -0,0 +1,33 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export class B {
>B : Symbol(B, Decl(0.ts, 0, 0))
print() { return "I am B"}
>print : Symbol(B.print, Decl(0.ts, 0, 16))
}
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
function foo(x: Promise<any>) {
>foo : Symbol(foo, Decl(2.ts, 0, 0))
>x : Symbol(x, Decl(2.ts, 0, 13))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
x.then(value => {
>x.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(2.ts, 0, 13))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>value : Symbol(value, Decl(2.ts, 1, 11))
let b = new value.B();
>b : Symbol(b, Decl(2.ts, 2, 11))
>value : Symbol(value, Decl(2.ts, 1, 11))
b.print();
>b : Symbol(b, Decl(2.ts, 2, 11))
})
}
foo(import("./0"));
>foo : Symbol(foo, Decl(2.ts, 0, 0))
@@ -0,0 +1,45 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export class B {
>B : B
print() { return "I am B"}
>print : () => string
>"I am B" : "I am B"
}
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
function foo(x: Promise<any>) {
>foo : (x: Promise<any>) => void
>x : Promise<any>
>Promise : Promise<T>
x.then(value => {
>x.then(value => { let b = new value.B(); b.print(); }) : Promise<void>
>x.then : <TResult1 = any, TResult2 = never>(onfulfilled?: (value: any) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>x : Promise<any>
>then : <TResult1 = any, TResult2 = never>(onfulfilled?: (value: any) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>value => { let b = new value.B(); b.print(); } : (value: any) => void
>value : any
let b = new value.B();
>b : any
>new value.B() : any
>value.B : any
>value : any
>B : any
b.print();
>b.print() : any
>b.print : any
>b : any
>print : any
})
}
foo(import("./0"));
>foo(import("./0")) : void
>foo : (x: Promise<any>) => void
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
@@ -0,0 +1,49 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpression4ES2018.ts] ////
//// [0.ts]
export class B {
print() { return "I am B"}
}
export function foo() { return "foo" }
//// [1.ts]
export function backup() { return "backup"; }
//// [2.ts]
declare var console: any;
class C {
private myModule = import("./0");
method() {
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
console.log(err);
let one = await import("./1");
console.log(one.backup());
});
}
}
//// [0.js]
export class B {
print() { return "I am B"; }
}
export function foo() { return "foo"; }
//// [1.js]
export function backup() { return "backup"; }
//// [2.js]
class C {
constructor() {
this.myModule = import("./0");
}
method() {
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async (err) => {
console.log(err);
let one = await import("./1");
console.log(one.backup());
});
}
}
@@ -0,0 +1,61 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export class B {
>B : Symbol(B, Decl(0.ts, 0, 0))
print() { return "I am B"}
>print : Symbol(B.print, Decl(0.ts, 0, 16))
}
export function foo() { return "foo" }
>foo : Symbol(foo, Decl(0.ts, 2, 1))
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
export function backup() { return "backup"; }
>backup : Symbol(backup, Decl(1.ts, 0, 0))
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
declare var console: any;
>console : Symbol(console, Decl(2.ts, 0, 11))
class C {
>C : Symbol(C, Decl(2.ts, 0, 25))
private myModule = import("./0");
>myModule : Symbol(C.myModule, Decl(2.ts, 1, 9))
method() {
>method : Symbol(C.method, Decl(2.ts, 2, 37))
this.myModule.then(Zero => {
>this.myModule.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>this.myModule : Symbol(C.myModule, Decl(2.ts, 1, 9))
>this : Symbol(C, Decl(2.ts, 0, 25))
>myModule : Symbol(C.myModule, Decl(2.ts, 1, 9))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Zero : Symbol(Zero, Decl(2.ts, 4, 27))
console.log(Zero.foo());
>console : Symbol(console, Decl(2.ts, 0, 11))
>Zero.foo : Symbol(foo, Decl(0.ts, 2, 1))
>Zero : Symbol(Zero, Decl(2.ts, 4, 27))
>foo : Symbol(foo, Decl(0.ts, 2, 1))
}, async err => {
>err : Symbol(err, Decl(2.ts, 6, 16))
console.log(err);
>console : Symbol(console, Decl(2.ts, 0, 11))
>err : Symbol(err, Decl(2.ts, 6, 16))
let one = await import("./1");
>one : Symbol(one, Decl(2.ts, 8, 15))
console.log(one.backup());
>console : Symbol(console, Decl(2.ts, 0, 11))
>one.backup : Symbol(backup, Decl(1.ts, 0, 0))
>one : Symbol(one, Decl(2.ts, 8, 15))
>backup : Symbol(backup, Decl(1.ts, 0, 0))
});
}
}
@@ -0,0 +1,83 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export class B {
>B : B
print() { return "I am B"}
>print : () => string
>"I am B" : "I am B"
}
export function foo() { return "foo" }
>foo : () => string
>"foo" : "foo"
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
export function backup() { return "backup"; }
>backup : () => string
>"backup" : "backup"
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
declare var console: any;
>console : any
class C {
>C : C
private myModule = import("./0");
>myModule : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
method() {
>method : () => void
this.myModule.then(Zero => {
>this.myModule.then(Zero => { console.log(Zero.foo()); }, async err => { console.log(err); let one = await import("./1"); console.log(one.backup()); }) : Promise<void>
>this.myModule.then : <TResult1 = typeof "tests/cases/conformance/es2018/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/es2018/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>this.myModule : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>this : this
>myModule : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>then : <TResult1 = typeof "tests/cases/conformance/es2018/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/es2018/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>Zero => { console.log(Zero.foo()); } : (Zero: typeof "tests/cases/conformance/es2018/dynamicImport/0") => void
>Zero : typeof "tests/cases/conformance/es2018/dynamicImport/0"
console.log(Zero.foo());
>console.log(Zero.foo()) : any
>console.log : any
>console : any
>log : any
>Zero.foo() : string
>Zero.foo : () => string
>Zero : typeof "tests/cases/conformance/es2018/dynamicImport/0"
>foo : () => string
}, async err => {
>async err => { console.log(err); let one = await import("./1"); console.log(one.backup()); } : (err: any) => Promise<void>
>err : any
console.log(err);
>console.log(err) : any
>console.log : any
>console : any
>log : any
>err : any
let one = await import("./1");
>one : typeof "tests/cases/conformance/es2018/dynamicImport/1"
>await import("./1") : typeof "tests/cases/conformance/es2018/dynamicImport/1"
>import("./1") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/1">
>"./1" : "./1"
console.log(one.backup());
>console.log(one.backup()) : any
>console.log : any
>console : any
>log : any
>one.backup() : string
>one.backup : () => string
>one : typeof "tests/cases/conformance/es2018/dynamicImport/1"
>backup : () => string
});
}
}
@@ -0,0 +1,31 @@
tests/cases/conformance/es2018/dynamicImport/1.ts(4,5): error TS2322: Type 'Promise<typeof "tests/cases/conformance/es2018/dynamicImport/defaultPath">' is not assignable to type 'Promise<typeof "tests/cases/conformance/es2018/dynamicImport/anotherModule">'.
Type 'typeof "tests/cases/conformance/es2018/dynamicImport/defaultPath"' is not assignable to type 'typeof "tests/cases/conformance/es2018/dynamicImport/anotherModule"'.
Property 'D' is missing in type 'typeof "tests/cases/conformance/es2018/dynamicImport/defaultPath"'.
tests/cases/conformance/es2018/dynamicImport/1.ts(5,10): error TS2352: Type 'Promise<typeof "tests/cases/conformance/es2018/dynamicImport/defaultPath">' cannot be converted to type 'Promise<typeof "tests/cases/conformance/es2018/dynamicImport/anotherModule">'.
Type 'typeof "tests/cases/conformance/es2018/dynamicImport/defaultPath"' is not comparable to type 'typeof "tests/cases/conformance/es2018/dynamicImport/anotherModule"'.
Property 'D' is missing in type 'typeof "tests/cases/conformance/es2018/dynamicImport/defaultPath"'.
==== tests/cases/conformance/es2018/dynamicImport/anotherModule.ts (0 errors) ====
export class D{}
==== tests/cases/conformance/es2018/dynamicImport/defaultPath.ts (0 errors) ====
export class C {}
==== tests/cases/conformance/es2018/dynamicImport/1.ts (2 errors) ====
import * as defaultModule from "./defaultPath";
import * as anotherModule from "./anotherModule";
let p1: Promise<typeof anotherModule> = import("./defaultPath");
~~
!!! error TS2322: Type 'Promise<typeof "tests/cases/conformance/es2018/dynamicImport/defaultPath">' is not assignable to type 'Promise<typeof "tests/cases/conformance/es2018/dynamicImport/anotherModule">'.
!!! error TS2322: Type 'typeof "tests/cases/conformance/es2018/dynamicImport/defaultPath"' is not assignable to type 'typeof "tests/cases/conformance/es2018/dynamicImport/anotherModule"'.
!!! error TS2322: Property 'D' is missing in type 'typeof "tests/cases/conformance/es2018/dynamicImport/defaultPath"'.
let p2 = import("./defaultPath") as Promise<typeof anotherModule>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2352: Type 'Promise<typeof "tests/cases/conformance/es2018/dynamicImport/defaultPath">' cannot be converted to type 'Promise<typeof "tests/cases/conformance/es2018/dynamicImport/anotherModule">'.
!!! error TS2352: Type 'typeof "tests/cases/conformance/es2018/dynamicImport/defaultPath"' is not comparable to type 'typeof "tests/cases/conformance/es2018/dynamicImport/anotherModule"'.
!!! error TS2352: Property 'D' is missing in type 'typeof "tests/cases/conformance/es2018/dynamicImport/defaultPath"'.
let p3: Promise<any> = import("./defaultPath");
@@ -0,0 +1,36 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpressionCheckReturntype1.ts] ////
//// [anotherModule.ts]
export class D{}
//// [defaultPath.ts]
export class C {}
//// [1.ts]
import * as defaultModule from "./defaultPath";
import * as anotherModule from "./anotherModule";
let p1: Promise<typeof anotherModule> = import("./defaultPath");
let p2 = import("./defaultPath") as Promise<typeof anotherModule>;
let p3: Promise<any> = import("./defaultPath");
//// [anotherModule.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class D {
}
exports.D = D;
//// [defaultPath.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class C {
}
exports.C = C;
//// [1.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
let p1 = Promise.resolve().then(() => require("./defaultPath"));
let p2 = Promise.resolve().then(() => require("./defaultPath"));
let p3 = Promise.resolve().then(() => require("./defaultPath"));
@@ -0,0 +1,37 @@
//// [importCallExpressionDeclarationEmit1.ts]
declare function getSpecifier(): string;
declare var whatToLoad: boolean;
declare const directory: string;
declare const moduleFile: number;
import(getSpecifier());
var p0 = import(`${directory}\${moduleFile}`);
var p1 = import(getSpecifier());
const p2 = import(whatToLoad ? getSpecifier() : "defaulPath")
function returnDynamicLoad(path: string) {
return import(path);
}
//// [importCallExpressionDeclarationEmit1.js]
"use strict";
Promise.resolve().then(() => require(getSpecifier()));
var p0 = Promise.resolve().then(() => require(`${directory}\${moduleFile}`));
var p1 = Promise.resolve().then(() => require(getSpecifier()));
const p2 = Promise.resolve().then(() => require(whatToLoad ? getSpecifier() : "defaulPath"));
function returnDynamicLoad(path) {
return Promise.resolve().then(() => require(path));
}
//// [importCallExpressionDeclarationEmit1.d.ts]
declare function getSpecifier(): string;
declare var whatToLoad: boolean;
declare const directory: string;
declare const moduleFile: number;
declare var p0: Promise<any>;
declare var p1: Promise<any>;
declare const p2: Promise<any>;
declare function returnDynamicLoad(path: string): Promise<any>;
@@ -0,0 +1,37 @@
=== tests/cases/conformance/es2018/dynamicImport/importCallExpressionDeclarationEmit1.ts ===
declare function getSpecifier(): string;
>getSpecifier : Symbol(getSpecifier, Decl(importCallExpressionDeclarationEmit1.ts, 0, 0))
declare var whatToLoad: boolean;
>whatToLoad : Symbol(whatToLoad, Decl(importCallExpressionDeclarationEmit1.ts, 2, 11))
declare const directory: string;
>directory : Symbol(directory, Decl(importCallExpressionDeclarationEmit1.ts, 3, 13))
declare const moduleFile: number;
>moduleFile : Symbol(moduleFile, Decl(importCallExpressionDeclarationEmit1.ts, 4, 13))
import(getSpecifier());
>getSpecifier : Symbol(getSpecifier, Decl(importCallExpressionDeclarationEmit1.ts, 0, 0))
var p0 = import(`${directory}\${moduleFile}`);
>p0 : Symbol(p0, Decl(importCallExpressionDeclarationEmit1.ts, 8, 3))
>directory : Symbol(directory, Decl(importCallExpressionDeclarationEmit1.ts, 3, 13))
var p1 = import(getSpecifier());
>p1 : Symbol(p1, Decl(importCallExpressionDeclarationEmit1.ts, 9, 3))
>getSpecifier : Symbol(getSpecifier, Decl(importCallExpressionDeclarationEmit1.ts, 0, 0))
const p2 = import(whatToLoad ? getSpecifier() : "defaulPath")
>p2 : Symbol(p2, Decl(importCallExpressionDeclarationEmit1.ts, 10, 5))
>whatToLoad : Symbol(whatToLoad, Decl(importCallExpressionDeclarationEmit1.ts, 2, 11))
>getSpecifier : Symbol(getSpecifier, Decl(importCallExpressionDeclarationEmit1.ts, 0, 0))
function returnDynamicLoad(path: string) {
>returnDynamicLoad : Symbol(returnDynamicLoad, Decl(importCallExpressionDeclarationEmit1.ts, 10, 61))
>path : Symbol(path, Decl(importCallExpressionDeclarationEmit1.ts, 12, 27))
return import(path);
>path : Symbol(path, Decl(importCallExpressionDeclarationEmit1.ts, 12, 27))
}
@@ -0,0 +1,48 @@
=== tests/cases/conformance/es2018/dynamicImport/importCallExpressionDeclarationEmit1.ts ===
declare function getSpecifier(): string;
>getSpecifier : () => string
declare var whatToLoad: boolean;
>whatToLoad : boolean
declare const directory: string;
>directory : string
declare const moduleFile: number;
>moduleFile : number
import(getSpecifier());
>import(getSpecifier()) : Promise<any>
>getSpecifier() : string
>getSpecifier : () => string
var p0 = import(`${directory}\${moduleFile}`);
>p0 : Promise<any>
>import(`${directory}\${moduleFile}`) : Promise<any>
>`${directory}\${moduleFile}` : string
>directory : string
var p1 = import(getSpecifier());
>p1 : Promise<any>
>import(getSpecifier()) : Promise<any>
>getSpecifier() : string
>getSpecifier : () => string
const p2 = import(whatToLoad ? getSpecifier() : "defaulPath")
>p2 : Promise<any>
>import(whatToLoad ? getSpecifier() : "defaulPath") : Promise<any>
>whatToLoad ? getSpecifier() : "defaulPath" : string
>whatToLoad : boolean
>getSpecifier() : string
>getSpecifier : () => string
>"defaulPath" : "defaulPath"
function returnDynamicLoad(path: string) {
>returnDynamicLoad : (path: string) => Promise<any>
>path : string
return import(path);
>import(path) : Promise<any>
>path : string
}
@@ -0,0 +1,11 @@
tests/cases/conformance/es2018/dynamicImport/1.ts(1,5): error TS4023: Exported variable 'p1' has or is using name '"tests/cases/conformance/es2018/dynamicImport/0"' from external module "tests/cases/conformance/es2018/dynamicImport/0" but cannot be named.
==== tests/cases/conformance/es2018/dynamicImport/0.ts (0 errors) ====
export function foo() { return "foo"; }
==== tests/cases/conformance/es2018/dynamicImport/1.ts (1 errors) ====
var p1 = import("./0");
~~
!!! error TS4023: Exported variable 'p1' has or is using name '"tests/cases/conformance/es2018/dynamicImport/0"' from external module "tests/cases/conformance/es2018/dynamicImport/0" but cannot be named.
@@ -0,0 +1,17 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpressionDeclarationEmit2.ts] ////
//// [0.ts]
export function foo() { return "foo"; }
//// [1.ts]
var p1 = import("./0");
//// [0.js]
export function foo() { return "foo"; }
//// [1.js]
var p1 = import("./0");
//// [0.d.ts]
export declare function foo(): string;
@@ -0,0 +1,32 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpressionDeclarationEmit3.ts] ////
//// [0.ts]
export function foo() { return "foo"; }
//// [1.ts]
declare function getPath(): string;
import * as Zero from "./0";
import("./0");
export var p0: Promise<typeof Zero> = import(getPath());
export var p1: Promise<typeof Zero> = import("./0");
export var p2: Promise<any> = import("./0");
//// [0.js]
export function foo() { return "foo"; }
//// [1.js]
import("./0");
export var p0 = import(getPath());
export var p1 = import("./0");
export var p2 = import("./0");
//// [0.d.ts]
export declare function foo(): string;
//// [1.d.ts]
import * as Zero from "./0";
export declare var p0: Promise<typeof Zero>;
export declare var p1: Promise<typeof Zero>;
export declare var p2: Promise<any>;
@@ -0,0 +1,29 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export function foo() { return "foo"; }
>foo : Symbol(foo, Decl(0.ts, 0, 0))
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
declare function getPath(): string;
>getPath : Symbol(getPath, Decl(1.ts, 0, 0))
import * as Zero from "./0";
>Zero : Symbol(Zero, Decl(1.ts, 1, 6))
import("./0");
export var p0: Promise<typeof Zero> = import(getPath());
>p0 : Symbol(p0, Decl(1.ts, 4, 10))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>Zero : Symbol(Zero, Decl(1.ts, 1, 6))
>getPath : Symbol(getPath, Decl(1.ts, 0, 0))
export var p1: Promise<typeof Zero> = import("./0");
>p1 : Symbol(p1, Decl(1.ts, 5, 10))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>Zero : Symbol(Zero, Decl(1.ts, 1, 6))
export var p2: Promise<any> = import("./0");
>p2 : Symbol(p2, Decl(1.ts, 6, 10))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
@@ -0,0 +1,38 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export function foo() { return "foo"; }
>foo : () => string
>"foo" : "foo"
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
declare function getPath(): string;
>getPath : () => string
import * as Zero from "./0";
>Zero : typeof Zero
import("./0");
>import("./0") : Promise<typeof Zero>
>"./0" : "./0"
export var p0: Promise<typeof Zero> = import(getPath());
>p0 : Promise<typeof Zero>
>Promise : Promise<T>
>Zero : typeof Zero
>import(getPath()) : Promise<any>
>getPath() : string
>getPath : () => string
export var p1: Promise<typeof Zero> = import("./0");
>p1 : Promise<typeof Zero>
>Promise : Promise<T>
>Zero : typeof Zero
>import("./0") : Promise<typeof Zero>
>"./0" : "./0"
export var p2: Promise<any> = import("./0");
>p2 : Promise<any>
>Promise : Promise<T>
>import("./0") : Promise<typeof Zero>
>"./0" : "./0"
@@ -0,0 +1,24 @@
tests/cases/conformance/es2018/dynamicImport/1.ts(1,1): error TS1320: Dynamic import cannot be used when targeting ECMAScript 2015 modules.
tests/cases/conformance/es2018/dynamicImport/1.ts(2,10): error TS1320: Dynamic import cannot be used when targeting ECMAScript 2015 modules.
tests/cases/conformance/es2018/dynamicImport/1.ts(8,16): error TS1320: Dynamic import cannot be used when targeting ECMAScript 2015 modules.
==== tests/cases/conformance/es2018/dynamicImport/0.ts (0 errors) ====
export function foo() { return "foo"; }
==== tests/cases/conformance/es2018/dynamicImport/1.ts (3 errors) ====
import("./0");
~~~~~~~~~~~~~
!!! error TS1320: Dynamic import cannot be used when targeting ECMAScript 2015 modules.
var p1 = import("./0");
~~~~~~~~~~~~~
!!! error TS1320: Dynamic import cannot be used when targeting ECMAScript 2015 modules.
p1.then(zero => {
return zero.foo();
})
function foo() {
const p2 = import("./0");
~~~~~~~~~~~~~
!!! error TS1320: Dynamic import cannot be used when targeting ECMAScript 2015 modules.
}
@@ -0,0 +1,27 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpressionErrorInES2015.ts] ////
//// [0.ts]
export function foo() { return "foo"; }
//// [1.ts]
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
})
function foo() {
const p2 = import("./0");
}
//// [0.js]
export function foo() { return "foo"; }
//// [1.js]
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
function foo() {
const p2 = import("./0");
}
@@ -0,0 +1,29 @@
tests/cases/conformance/es2018/dynamicImport/importCallExpressionGrammarError.ts(6,8): error TS1322: Specifier of dynamic import cannot be spread element.
tests/cases/conformance/es2018/dynamicImport/importCallExpressionGrammarError.ts(8,17): error TS1322: Specifier of dynamic import cannot be spread element.
tests/cases/conformance/es2018/dynamicImport/importCallExpressionGrammarError.ts(9,12): error TS1321: Dynamic import must have one specifier as an argument.
tests/cases/conformance/es2018/dynamicImport/importCallExpressionGrammarError.ts(10,19): error TS1135: Argument expression expected.
tests/cases/conformance/es2018/dynamicImport/importCallExpressionGrammarError.ts(11,12): error TS1321: Dynamic import must have one specifier as an argument.
==== tests/cases/conformance/es2018/dynamicImport/importCallExpressionGrammarError.ts (5 errors) ====
declare function getSpecifier(): string;
declare var whatToLoad: boolean;
var a = ["./0"];
import(...["PathModule"]);
~~~~~~~~~~~~~~~~~
!!! error TS1322: Specifier of dynamic import cannot be spread element.
var p1 = import(...a);
~~~~
!!! error TS1322: Specifier of dynamic import cannot be spread element.
const p2 = import();
~~~~~~~~
!!! error TS1321: Dynamic import must have one specifier as an argument.
const p3 = import(,);
!!! error TS1135: Argument expression expected.
const p4 = import("pathToModule", "secondModule");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1321: Dynamic import must have one specifier as an argument.
@@ -0,0 +1,21 @@
//// [importCallExpressionGrammarError.ts]
declare function getSpecifier(): string;
declare var whatToLoad: boolean;
var a = ["./0"];
import(...["PathModule"]);
var p1 = import(...a);
const p2 = import();
const p3 = import(,);
const p4 = import("pathToModule", "secondModule");
//// [importCallExpressionGrammarError.js]
"use strict";
var a = ["./0"];
Promise.resolve().then(() => require(...["PathModule"]));
var p1 = Promise.resolve().then(() => require(...a));
const p2 = Promise.resolve().then(() => require());
const p3 = Promise.resolve().then(() => require());
const p4 = Promise.resolve().then(() => require("pathToModule", "secondModule"));
@@ -0,0 +1,35 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpressionInAMD1.ts] ////
//// [0.ts]
export function foo() { return "foo"; }
//// [1.ts]
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
function foo() {
const p2 = import("./0");
}
//// [0.js]
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function foo() { return "foo"; }
exports.foo = foo;
});
//// [1.js]
define(["require", "exports"], function (require, exports) {
"use strict";
new Promise(resolve => require(["./0"], resolve));
var p1 = new Promise(resolve => require(["./0"], resolve));
p1.then(zero => {
return zero.foo();
});
function foo() {
const p2 = new Promise(resolve => require(["./0"], resolve));
}
});
@@ -0,0 +1,28 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export function foo() { return "foo"; }
>foo : Symbol(foo, Decl(0.ts, 0, 0))
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
import("./0");
var p1 = import("./0");
>p1 : Symbol(p1, Decl(1.ts, 1, 3))
p1.then(zero => {
>p1.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p1 : Symbol(p1, Decl(1.ts, 1, 3))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>zero : Symbol(zero, Decl(1.ts, 2, 8))
return zero.foo();
>zero.foo : Symbol(foo, Decl(0.ts, 0, 0))
>zero : Symbol(zero, Decl(1.ts, 2, 8))
>foo : Symbol(foo, Decl(0.ts, 0, 0))
});
function foo() {
>foo : Symbol(foo, Decl(1.ts, 4, 3))
const p2 = import("./0");
>p2 : Symbol(p2, Decl(1.ts, 7, 9))
}
@@ -0,0 +1,39 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export function foo() { return "foo"; }
>foo : () => string
>"foo" : "foo"
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
import("./0");
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
var p1 = import("./0");
>p1 : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
p1.then(zero => {
>p1.then(zero => { return zero.foo();}) : Promise<string>
>p1.then : <TResult1 = typeof "tests/cases/conformance/es2018/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/es2018/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>p1 : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>then : <TResult1 = typeof "tests/cases/conformance/es2018/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/es2018/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>zero => { return zero.foo();} : (zero: typeof "tests/cases/conformance/es2018/dynamicImport/0") => string
>zero : typeof "tests/cases/conformance/es2018/dynamicImport/0"
return zero.foo();
>zero.foo() : string
>zero.foo : () => string
>zero : typeof "tests/cases/conformance/es2018/dynamicImport/0"
>foo : () => string
});
function foo() {
>foo : () => void
const p2 = import("./0");
>p2 : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
}
@@ -0,0 +1,39 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpressionInAMD2.ts] ////
//// [0.ts]
export class B {
print() { return "I am B"}
}
//// [2.ts]
// We use Promise<any> for now as there is no way to specify shape of module object
function foo(x: Promise<any>) {
x.then(value => {
let b = new value.B();
b.print();
})
}
foo(import("./0"));
//// [0.js]
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class B {
print() { return "I am B"; }
}
exports.B = B;
});
//// [2.js]
define(["require", "exports"], function (require, exports) {
"use strict";
// We use Promise<any> for now as there is no way to specify shape of module object
function foo(x) {
x.then(value => {
let b = new value.B();
b.print();
});
}
foo(new Promise(resolve => require(["./0"], resolve)));
});
@@ -0,0 +1,34 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export class B {
>B : Symbol(B, Decl(0.ts, 0, 0))
print() { return "I am B"}
>print : Symbol(B.print, Decl(0.ts, 0, 16))
}
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
// We use Promise<any> for now as there is no way to specify shape of module object
function foo(x: Promise<any>) {
>foo : Symbol(foo, Decl(2.ts, 0, 0))
>x : Symbol(x, Decl(2.ts, 1, 13))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
x.then(value => {
>x.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(2.ts, 1, 13))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>value : Symbol(value, Decl(2.ts, 2, 11))
let b = new value.B();
>b : Symbol(b, Decl(2.ts, 3, 11))
>value : Symbol(value, Decl(2.ts, 2, 11))
b.print();
>b : Symbol(b, Decl(2.ts, 3, 11))
})
}
foo(import("./0"));
>foo : Symbol(foo, Decl(2.ts, 0, 0))
@@ -0,0 +1,46 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export class B {
>B : B
print() { return "I am B"}
>print : () => string
>"I am B" : "I am B"
}
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
// We use Promise<any> for now as there is no way to specify shape of module object
function foo(x: Promise<any>) {
>foo : (x: Promise<any>) => void
>x : Promise<any>
>Promise : Promise<T>
x.then(value => {
>x.then(value => { let b = new value.B(); b.print(); }) : Promise<void>
>x.then : <TResult1 = any, TResult2 = never>(onfulfilled?: (value: any) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>x : Promise<any>
>then : <TResult1 = any, TResult2 = never>(onfulfilled?: (value: any) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>value => { let b = new value.B(); b.print(); } : (value: any) => void
>value : any
let b = new value.B();
>b : any
>new value.B() : any
>value.B : any
>value : any
>B : any
b.print();
>b.print() : any
>b.print : any
>b : any
>print : any
})
}
foo(import("./0"));
>foo(import("./0")) : void
>foo : (x: Promise<any>) => void
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
@@ -0,0 +1,63 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpressionInAMD4.ts] ////
//// [0.ts]
export class B {
print() { return "I am B"}
}
export function foo() { return "foo" }
//// [1.ts]
export function backup() { return "backup"; }
//// [2.ts]
declare var console: any;
class C {
private myModule = import("./0");
method() {
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
console.log(err);
let one = await import("./1");
console.log(one.backup());
});
}
}
//// [0.js]
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class B {
print() { return "I am B"; }
}
exports.B = B;
function foo() { return "foo"; }
exports.foo = foo;
});
//// [1.js]
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function backup() { return "backup"; }
exports.backup = backup;
});
//// [2.js]
define(["require", "exports"], function (require, exports) {
"use strict";
class C {
constructor() {
this.myModule = new Promise(resolve => require(["./0"], resolve));
}
method() {
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async (err) => {
console.log(err);
let one = await new Promise(resolve => require(["./1"], resolve));
console.log(one.backup());
});
}
}
});
@@ -0,0 +1,61 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export class B {
>B : Symbol(B, Decl(0.ts, 0, 0))
print() { return "I am B"}
>print : Symbol(B.print, Decl(0.ts, 0, 16))
}
export function foo() { return "foo" }
>foo : Symbol(foo, Decl(0.ts, 2, 1))
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
export function backup() { return "backup"; }
>backup : Symbol(backup, Decl(1.ts, 0, 0))
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
declare var console: any;
>console : Symbol(console, Decl(2.ts, 0, 11))
class C {
>C : Symbol(C, Decl(2.ts, 0, 25))
private myModule = import("./0");
>myModule : Symbol(C.myModule, Decl(2.ts, 1, 9))
method() {
>method : Symbol(C.method, Decl(2.ts, 2, 37))
this.myModule.then(Zero => {
>this.myModule.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>this.myModule : Symbol(C.myModule, Decl(2.ts, 1, 9))
>this : Symbol(C, Decl(2.ts, 0, 25))
>myModule : Symbol(C.myModule, Decl(2.ts, 1, 9))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Zero : Symbol(Zero, Decl(2.ts, 4, 27))
console.log(Zero.foo());
>console : Symbol(console, Decl(2.ts, 0, 11))
>Zero.foo : Symbol(foo, Decl(0.ts, 2, 1))
>Zero : Symbol(Zero, Decl(2.ts, 4, 27))
>foo : Symbol(foo, Decl(0.ts, 2, 1))
}, async err => {
>err : Symbol(err, Decl(2.ts, 6, 16))
console.log(err);
>console : Symbol(console, Decl(2.ts, 0, 11))
>err : Symbol(err, Decl(2.ts, 6, 16))
let one = await import("./1");
>one : Symbol(one, Decl(2.ts, 8, 15))
console.log(one.backup());
>console : Symbol(console, Decl(2.ts, 0, 11))
>one.backup : Symbol(backup, Decl(1.ts, 0, 0))
>one : Symbol(one, Decl(2.ts, 8, 15))
>backup : Symbol(backup, Decl(1.ts, 0, 0))
});
}
}
@@ -0,0 +1,83 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export class B {
>B : B
print() { return "I am B"}
>print : () => string
>"I am B" : "I am B"
}
export function foo() { return "foo" }
>foo : () => string
>"foo" : "foo"
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
export function backup() { return "backup"; }
>backup : () => string
>"backup" : "backup"
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
declare var console: any;
>console : any
class C {
>C : C
private myModule = import("./0");
>myModule : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
method() {
>method : () => void
this.myModule.then(Zero => {
>this.myModule.then(Zero => { console.log(Zero.foo()); }, async err => { console.log(err); let one = await import("./1"); console.log(one.backup()); }) : Promise<void>
>this.myModule.then : <TResult1 = typeof "tests/cases/conformance/es2018/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/es2018/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>this.myModule : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>this : this
>myModule : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>then : <TResult1 = typeof "tests/cases/conformance/es2018/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/es2018/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>Zero => { console.log(Zero.foo()); } : (Zero: typeof "tests/cases/conformance/es2018/dynamicImport/0") => void
>Zero : typeof "tests/cases/conformance/es2018/dynamicImport/0"
console.log(Zero.foo());
>console.log(Zero.foo()) : any
>console.log : any
>console : any
>log : any
>Zero.foo() : string
>Zero.foo : () => string
>Zero : typeof "tests/cases/conformance/es2018/dynamicImport/0"
>foo : () => string
}, async err => {
>async err => { console.log(err); let one = await import("./1"); console.log(one.backup()); } : (err: any) => Promise<void>
>err : any
console.log(err);
>console.log(err) : any
>console.log : any
>console : any
>log : any
>err : any
let one = await import("./1");
>one : typeof "tests/cases/conformance/es2018/dynamicImport/1"
>await import("./1") : typeof "tests/cases/conformance/es2018/dynamicImport/1"
>import("./1") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/1">
>"./1" : "./1"
console.log(one.backup());
>console.log(one.backup()) : any
>console.log : any
>console : any
>log : any
>one.backup() : string
>one.backup : () => string
>one : typeof "tests/cases/conformance/es2018/dynamicImport/1"
>backup : () => string
});
}
}
@@ -0,0 +1,31 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpressionInCJS1.ts] ////
//// [0.ts]
export function foo() { return "foo"; }
//// [1.ts]
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
function foo() {
const p2 = import("./0");
}
//// [0.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function foo() { return "foo"; }
exports.foo = foo;
//// [1.js]
"use strict";
Promise.resolve().then(() => require("./0"));
var p1 = Promise.resolve().then(() => require("./0"));
p1.then(zero => {
return zero.foo();
});
function foo() {
const p2 = Promise.resolve().then(() => require("./0"));
}
@@ -0,0 +1,28 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export function foo() { return "foo"; }
>foo : Symbol(foo, Decl(0.ts, 0, 0))
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
import("./0");
var p1 = import("./0");
>p1 : Symbol(p1, Decl(1.ts, 1, 3))
p1.then(zero => {
>p1.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p1 : Symbol(p1, Decl(1.ts, 1, 3))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>zero : Symbol(zero, Decl(1.ts, 2, 8))
return zero.foo();
>zero.foo : Symbol(foo, Decl(0.ts, 0, 0))
>zero : Symbol(zero, Decl(1.ts, 2, 8))
>foo : Symbol(foo, Decl(0.ts, 0, 0))
});
function foo() {
>foo : Symbol(foo, Decl(1.ts, 4, 3))
const p2 = import("./0");
>p2 : Symbol(p2, Decl(1.ts, 7, 9))
}
@@ -0,0 +1,39 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export function foo() { return "foo"; }
>foo : () => string
>"foo" : "foo"
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
import("./0");
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
var p1 = import("./0");
>p1 : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
p1.then(zero => {
>p1.then(zero => { return zero.foo();}) : Promise<string>
>p1.then : <TResult1 = typeof "tests/cases/conformance/es2018/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/es2018/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>p1 : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>then : <TResult1 = typeof "tests/cases/conformance/es2018/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/es2018/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>zero => { return zero.foo();} : (zero: typeof "tests/cases/conformance/es2018/dynamicImport/0") => string
>zero : typeof "tests/cases/conformance/es2018/dynamicImport/0"
return zero.foo();
>zero.foo() : string
>zero.foo : () => string
>zero : typeof "tests/cases/conformance/es2018/dynamicImport/0"
>foo : () => string
});
function foo() {
>foo : () => void
const p2 = import("./0");
>p2 : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
}
@@ -0,0 +1,41 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpressionInCJS2.ts] ////
//// [0.ts]
export function foo() { return "foo"; }
//// [1.ts]
export function backup() { return "backup"; }
//// [2.ts]
async function compute(promise: Promise<any>) {
let j = await promise;
if (!j) {
j = await import("./1");
return j.backup();
}
return j.foo();
}
compute(import("./0"));
//// [0.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function foo() { return "foo"; }
exports.foo = foo;
//// [1.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function backup() { return "backup"; }
exports.backup = backup;
//// [2.js]
"use strict";
async function compute(promise) {
let j = await promise;
if (!j) {
j = await Promise.resolve().then(() => require("./1"));
return j.backup();
}
return j.foo();
}
compute(Promise.resolve().then(() => require("./0")));
@@ -0,0 +1,34 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export function foo() { return "foo"; }
>foo : Symbol(foo, Decl(0.ts, 0, 0))
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
export function backup() { return "backup"; }
>backup : Symbol(backup, Decl(1.ts, 0, 0))
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
async function compute(promise: Promise<any>) {
>compute : Symbol(compute, Decl(2.ts, 0, 0))
>promise : Symbol(promise, Decl(2.ts, 0, 23))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
let j = await promise;
>j : Symbol(j, Decl(2.ts, 1, 7))
>promise : Symbol(promise, Decl(2.ts, 0, 23))
if (!j) {
>j : Symbol(j, Decl(2.ts, 1, 7))
j = await import("./1");
>j : Symbol(j, Decl(2.ts, 1, 7))
return j.backup();
>j : Symbol(j, Decl(2.ts, 1, 7))
}
return j.foo();
>j : Symbol(j, Decl(2.ts, 1, 7))
}
compute(import("./0"));
>compute : Symbol(compute, Decl(2.ts, 0, 0))
@@ -0,0 +1,51 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export function foo() { return "foo"; }
>foo : () => string
>"foo" : "foo"
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
export function backup() { return "backup"; }
>backup : () => string
>"backup" : "backup"
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
async function compute(promise: Promise<any>) {
>compute : (promise: Promise<any>) => Promise<any>
>promise : Promise<any>
>Promise : Promise<T>
let j = await promise;
>j : any
>await promise : any
>promise : Promise<any>
if (!j) {
>!j : boolean
>j : any
j = await import("./1");
>j = await import("./1") : typeof "tests/cases/conformance/es2018/dynamicImport/1"
>j : any
>await import("./1") : typeof "tests/cases/conformance/es2018/dynamicImport/1"
>import("./1") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/1">
>"./1" : "./1"
return j.backup();
>j.backup() : any
>j.backup : any
>j : any
>backup : any
}
return j.foo();
>j.foo() : any
>j.foo : any
>j : any
>foo : any
}
compute(import("./0"));
>compute(import("./0")) : Promise<any>
>compute : (promise: Promise<any>) => Promise<any>
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
@@ -0,0 +1,35 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpressionInCJS3.ts] ////
//// [0.ts]
export class B {
print() { return "I am B"}
}
//// [2.ts]
// We use Promise<any> for now as there is no way to specify shape of module object
function foo(x: Promise<any>) {
x.then(value => {
let b = new value.B();
b.print();
})
}
foo(import("./0"));
//// [0.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class B {
print() { return "I am B"; }
}
exports.B = B;
//// [2.js]
"use strict";
// We use Promise<any> for now as there is no way to specify shape of module object
function foo(x) {
x.then(value => {
let b = new value.B();
b.print();
});
}
foo(Promise.resolve().then(() => require("./0")));
@@ -0,0 +1,34 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export class B {
>B : Symbol(B, Decl(0.ts, 0, 0))
print() { return "I am B"}
>print : Symbol(B.print, Decl(0.ts, 0, 16))
}
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
// We use Promise<any> for now as there is no way to specify shape of module object
function foo(x: Promise<any>) {
>foo : Symbol(foo, Decl(2.ts, 0, 0))
>x : Symbol(x, Decl(2.ts, 1, 13))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
x.then(value => {
>x.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(2.ts, 1, 13))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>value : Symbol(value, Decl(2.ts, 2, 11))
let b = new value.B();
>b : Symbol(b, Decl(2.ts, 3, 11))
>value : Symbol(value, Decl(2.ts, 2, 11))
b.print();
>b : Symbol(b, Decl(2.ts, 3, 11))
})
}
foo(import("./0"));
>foo : Symbol(foo, Decl(2.ts, 0, 0))
@@ -0,0 +1,46 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export class B {
>B : B
print() { return "I am B"}
>print : () => string
>"I am B" : "I am B"
}
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
// We use Promise<any> for now as there is no way to specify shape of module object
function foo(x: Promise<any>) {
>foo : (x: Promise<any>) => void
>x : Promise<any>
>Promise : Promise<T>
x.then(value => {
>x.then(value => { let b = new value.B(); b.print(); }) : Promise<void>
>x.then : <TResult1 = any, TResult2 = never>(onfulfilled?: (value: any) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>x : Promise<any>
>then : <TResult1 = any, TResult2 = never>(onfulfilled?: (value: any) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>value => { let b = new value.B(); b.print(); } : (value: any) => void
>value : any
let b = new value.B();
>b : any
>new value.B() : any
>value.B : any
>value : any
>B : any
b.print();
>b.print() : any
>b.print : any
>b : any
>print : any
})
}
foo(import("./0"));
>foo(import("./0")) : void
>foo : (x: Promise<any>) => void
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
@@ -0,0 +1,57 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpressionInCJS5.ts] ////
//// [0.ts]
export class B {
print() { return "I am B"}
}
export function foo() { return "foo" }
//// [1.ts]
export function backup() { return "backup"; }
//// [2.ts]
declare var console: any;
class C {
private myModule = import("./0");
method() {
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
console.log(err);
let one = await import("./1");
console.log(one.backup());
});
}
}
//// [0.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class B {
print() { return "I am B"; }
}
exports.B = B;
function foo() { return "foo"; }
exports.foo = foo;
//// [1.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function backup() { return "backup"; }
exports.backup = backup;
//// [2.js]
"use strict";
class C {
constructor() {
this.myModule = Promise.resolve().then(() => require("./0"));
}
method() {
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async (err) => {
console.log(err);
let one = await Promise.resolve().then(() => require("./1"));
console.log(one.backup());
});
}
}
@@ -0,0 +1,61 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export class B {
>B : Symbol(B, Decl(0.ts, 0, 0))
print() { return "I am B"}
>print : Symbol(B.print, Decl(0.ts, 0, 16))
}
export function foo() { return "foo" }
>foo : Symbol(foo, Decl(0.ts, 2, 1))
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
export function backup() { return "backup"; }
>backup : Symbol(backup, Decl(1.ts, 0, 0))
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
declare var console: any;
>console : Symbol(console, Decl(2.ts, 0, 11))
class C {
>C : Symbol(C, Decl(2.ts, 0, 25))
private myModule = import("./0");
>myModule : Symbol(C.myModule, Decl(2.ts, 1, 9))
method() {
>method : Symbol(C.method, Decl(2.ts, 2, 37))
this.myModule.then(Zero => {
>this.myModule.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>this.myModule : Symbol(C.myModule, Decl(2.ts, 1, 9))
>this : Symbol(C, Decl(2.ts, 0, 25))
>myModule : Symbol(C.myModule, Decl(2.ts, 1, 9))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Zero : Symbol(Zero, Decl(2.ts, 4, 27))
console.log(Zero.foo());
>console : Symbol(console, Decl(2.ts, 0, 11))
>Zero.foo : Symbol(foo, Decl(0.ts, 2, 1))
>Zero : Symbol(Zero, Decl(2.ts, 4, 27))
>foo : Symbol(foo, Decl(0.ts, 2, 1))
}, async err => {
>err : Symbol(err, Decl(2.ts, 6, 16))
console.log(err);
>console : Symbol(console, Decl(2.ts, 0, 11))
>err : Symbol(err, Decl(2.ts, 6, 16))
let one = await import("./1");
>one : Symbol(one, Decl(2.ts, 8, 15))
console.log(one.backup());
>console : Symbol(console, Decl(2.ts, 0, 11))
>one.backup : Symbol(backup, Decl(1.ts, 0, 0))
>one : Symbol(one, Decl(2.ts, 8, 15))
>backup : Symbol(backup, Decl(1.ts, 0, 0))
});
}
}
@@ -0,0 +1,83 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export class B {
>B : B
print() { return "I am B"}
>print : () => string
>"I am B" : "I am B"
}
export function foo() { return "foo" }
>foo : () => string
>"foo" : "foo"
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
export function backup() { return "backup"; }
>backup : () => string
>"backup" : "backup"
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
declare var console: any;
>console : any
class C {
>C : C
private myModule = import("./0");
>myModule : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
method() {
>method : () => void
this.myModule.then(Zero => {
>this.myModule.then(Zero => { console.log(Zero.foo()); }, async err => { console.log(err); let one = await import("./1"); console.log(one.backup()); }) : Promise<void>
>this.myModule.then : <TResult1 = typeof "tests/cases/conformance/es2018/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/es2018/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>this.myModule : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>this : this
>myModule : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>then : <TResult1 = typeof "tests/cases/conformance/es2018/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/es2018/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>Zero => { console.log(Zero.foo()); } : (Zero: typeof "tests/cases/conformance/es2018/dynamicImport/0") => void
>Zero : typeof "tests/cases/conformance/es2018/dynamicImport/0"
console.log(Zero.foo());
>console.log(Zero.foo()) : any
>console.log : any
>console : any
>log : any
>Zero.foo() : string
>Zero.foo : () => string
>Zero : typeof "tests/cases/conformance/es2018/dynamicImport/0"
>foo : () => string
}, async err => {
>async err => { console.log(err); let one = await import("./1"); console.log(one.backup()); } : (err: any) => Promise<void>
>err : any
console.log(err);
>console.log(err) : any
>console.log : any
>console : any
>log : any
>err : any
let one = await import("./1");
>one : typeof "tests/cases/conformance/es2018/dynamicImport/1"
>await import("./1") : typeof "tests/cases/conformance/es2018/dynamicImport/1"
>import("./1") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/1">
>"./1" : "./1"
console.log(one.backup());
>console.log(one.backup()) : any
>console.log : any
>console : any
>log : any
>one.backup() : string
>one.backup : () => string
>one : typeof "tests/cases/conformance/es2018/dynamicImport/1"
>backup : () => string
});
}
}
@@ -0,0 +1,13 @@
tests/cases/conformance/es2018/dynamicImport/1.ts(3,10): error TS1100: Invalid use of 'arguments' in strict mode.
==== tests/cases/conformance/es2018/dynamicImport/0.ts (0 errors) ====
export function foo() { return "foo"; }
==== tests/cases/conformance/es2018/dynamicImport/1.ts (1 errors) ====
"use strict"
var p1 = import("./0");
function arguments() { }
~~~~~~~~~
!!! error TS1100: Invalid use of 'arguments' in strict mode.
@@ -0,0 +1,20 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpressionInScriptContext2.ts] ////
//// [0.ts]
export function foo() { return "foo"; }
//// [1.ts]
"use strict"
var p1 = import("./0");
function arguments() { }
//// [0.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function foo() { return "foo"; }
exports.foo = foo;
//// [1.js]
"use strict";
var p1 = Promise.resolve().then(() => require("./0"));
function arguments() { }
@@ -0,0 +1,47 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpressionInSystem1.ts] ////
//// [0.ts]
export function foo() { return "foo"; }
//// [1.ts]
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
function foo() {
const p2 = import("./0");
}
//// [0.js]
System.register([], function (exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
function foo() { return "foo"; }
exports_1("foo", foo);
return {
setters: [],
execute: function () {
}
};
});
//// [1.js]
System.register([], function (exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
function foo() {
const p2 = context_1.import("./0");
}
var p1;
return {
setters: [],
execute: function () {
context_1.import("./0");
p1 = context_1.import("./0");
p1.then(zero => {
return zero.foo();
});
}
};
});
@@ -0,0 +1,28 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export function foo() { return "foo"; }
>foo : Symbol(foo, Decl(0.ts, 0, 0))
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
import("./0");
var p1 = import("./0");
>p1 : Symbol(p1, Decl(1.ts, 1, 3))
p1.then(zero => {
>p1.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p1 : Symbol(p1, Decl(1.ts, 1, 3))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>zero : Symbol(zero, Decl(1.ts, 2, 8))
return zero.foo();
>zero.foo : Symbol(foo, Decl(0.ts, 0, 0))
>zero : Symbol(zero, Decl(1.ts, 2, 8))
>foo : Symbol(foo, Decl(0.ts, 0, 0))
});
function foo() {
>foo : Symbol(foo, Decl(1.ts, 4, 3))
const p2 = import("./0");
>p2 : Symbol(p2, Decl(1.ts, 7, 9))
}
@@ -0,0 +1,39 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export function foo() { return "foo"; }
>foo : () => string
>"foo" : "foo"
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
import("./0");
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
var p1 = import("./0");
>p1 : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
p1.then(zero => {
>p1.then(zero => { return zero.foo();}) : Promise<string>
>p1.then : <TResult1 = typeof "tests/cases/conformance/es2018/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/es2018/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>p1 : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>then : <TResult1 = typeof "tests/cases/conformance/es2018/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/es2018/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>zero => { return zero.foo();} : (zero: typeof "tests/cases/conformance/es2018/dynamicImport/0") => string
>zero : typeof "tests/cases/conformance/es2018/dynamicImport/0"
return zero.foo();
>zero.foo() : string
>zero.foo : () => string
>zero : typeof "tests/cases/conformance/es2018/dynamicImport/0"
>foo : () => string
});
function foo() {
>foo : () => void
const p2 = import("./0");
>p2 : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
}
@@ -0,0 +1,51 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpressionInSystem2.ts] ////
//// [0.ts]
export class B {
print() { return "I am B"}
}
//// [2.ts]
// We use Promise<any> for now as there is no way to specify shape of module object
function foo(x: Promise<any>) {
x.then(value => {
let b = new value.B();
b.print();
})
}
foo(import("./0"));
//// [0.js]
System.register([], function (exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
var B;
return {
setters: [],
execute: function () {
B = class B {
print() { return "I am B"; }
};
exports_1("B", B);
}
};
});
//// [2.js]
System.register([], function (exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
// We use Promise<any> for now as there is no way to specify shape of module object
function foo(x) {
x.then(value => {
let b = new value.B();
b.print();
});
}
return {
setters: [],
execute: function () {
foo(context_1.import("./0"));
}
};
});
@@ -0,0 +1,34 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export class B {
>B : Symbol(B, Decl(0.ts, 0, 0))
print() { return "I am B"}
>print : Symbol(B.print, Decl(0.ts, 0, 16))
}
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
// We use Promise<any> for now as there is no way to specify shape of module object
function foo(x: Promise<any>) {
>foo : Symbol(foo, Decl(2.ts, 0, 0))
>x : Symbol(x, Decl(2.ts, 1, 13))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
x.then(value => {
>x.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(2.ts, 1, 13))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>value : Symbol(value, Decl(2.ts, 2, 11))
let b = new value.B();
>b : Symbol(b, Decl(2.ts, 3, 11))
>value : Symbol(value, Decl(2.ts, 2, 11))
b.print();
>b : Symbol(b, Decl(2.ts, 3, 11))
})
}
foo(import("./0"));
>foo : Symbol(foo, Decl(2.ts, 0, 0))
@@ -0,0 +1,46 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export class B {
>B : B
print() { return "I am B"}
>print : () => string
>"I am B" : "I am B"
}
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
// We use Promise<any> for now as there is no way to specify shape of module object
function foo(x: Promise<any>) {
>foo : (x: Promise<any>) => void
>x : Promise<any>
>Promise : Promise<T>
x.then(value => {
>x.then(value => { let b = new value.B(); b.print(); }) : Promise<void>
>x.then : <TResult1 = any, TResult2 = never>(onfulfilled?: (value: any) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>x : Promise<any>
>then : <TResult1 = any, TResult2 = never>(onfulfilled?: (value: any) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>value => { let b = new value.B(); b.print(); } : (value: any) => void
>value : any
let b = new value.B();
>b : any
>new value.B() : any
>value.B : any
>value : any
>B : any
b.print();
>b.print() : any
>b.print : any
>b : any
>print : any
})
}
foo(import("./0"));
>foo(import("./0")) : void
>foo : (x: Promise<any>) => void
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
@@ -0,0 +1,81 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpressionInSystem4.ts] ////
//// [0.ts]
export class B {
print() { return "I am B"}
}
export function foo() { return "foo" }
//// [1.ts]
export function backup() { return "backup"; }
//// [2.ts]
declare var console: any;
class C {
private myModule = import("./0");
method() {
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
console.log(err);
let one = await import("./1");
console.log(one.backup());
});
}
}
//// [0.js]
System.register([], function (exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
function foo() { return "foo"; }
exports_1("foo", foo);
var B;
return {
setters: [],
execute: function () {
B = class B {
print() { return "I am B"; }
};
exports_1("B", B);
}
};
});
//// [1.js]
System.register([], function (exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
function backup() { return "backup"; }
exports_1("backup", backup);
return {
setters: [],
execute: function () {
}
};
});
//// [2.js]
System.register([], function (exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
var C;
return {
setters: [],
execute: function () {
C = class C {
constructor() {
this.myModule = context_1.import("./0");
}
method() {
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async (err) => {
console.log(err);
let one = await context_1.import("./1");
console.log(one.backup());
});
}
};
}
};
});
@@ -0,0 +1,61 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export class B {
>B : Symbol(B, Decl(0.ts, 0, 0))
print() { return "I am B"}
>print : Symbol(B.print, Decl(0.ts, 0, 16))
}
export function foo() { return "foo" }
>foo : Symbol(foo, Decl(0.ts, 2, 1))
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
export function backup() { return "backup"; }
>backup : Symbol(backup, Decl(1.ts, 0, 0))
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
declare var console: any;
>console : Symbol(console, Decl(2.ts, 0, 11))
class C {
>C : Symbol(C, Decl(2.ts, 0, 25))
private myModule = import("./0");
>myModule : Symbol(C.myModule, Decl(2.ts, 1, 9))
method() {
>method : Symbol(C.method, Decl(2.ts, 2, 37))
this.myModule.then(Zero => {
>this.myModule.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>this.myModule : Symbol(C.myModule, Decl(2.ts, 1, 9))
>this : Symbol(C, Decl(2.ts, 0, 25))
>myModule : Symbol(C.myModule, Decl(2.ts, 1, 9))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Zero : Symbol(Zero, Decl(2.ts, 4, 27))
console.log(Zero.foo());
>console : Symbol(console, Decl(2.ts, 0, 11))
>Zero.foo : Symbol(foo, Decl(0.ts, 2, 1))
>Zero : Symbol(Zero, Decl(2.ts, 4, 27))
>foo : Symbol(foo, Decl(0.ts, 2, 1))
}, async err => {
>err : Symbol(err, Decl(2.ts, 6, 16))
console.log(err);
>console : Symbol(console, Decl(2.ts, 0, 11))
>err : Symbol(err, Decl(2.ts, 6, 16))
let one = await import("./1");
>one : Symbol(one, Decl(2.ts, 8, 15))
console.log(one.backup());
>console : Symbol(console, Decl(2.ts, 0, 11))
>one.backup : Symbol(backup, Decl(1.ts, 0, 0))
>one : Symbol(one, Decl(2.ts, 8, 15))
>backup : Symbol(backup, Decl(1.ts, 0, 0))
});
}
}
@@ -0,0 +1,83 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export class B {
>B : B
print() { return "I am B"}
>print : () => string
>"I am B" : "I am B"
}
export function foo() { return "foo" }
>foo : () => string
>"foo" : "foo"
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
export function backup() { return "backup"; }
>backup : () => string
>"backup" : "backup"
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
declare var console: any;
>console : any
class C {
>C : C
private myModule = import("./0");
>myModule : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
method() {
>method : () => void
this.myModule.then(Zero => {
>this.myModule.then(Zero => { console.log(Zero.foo()); }, async err => { console.log(err); let one = await import("./1"); console.log(one.backup()); }) : Promise<void>
>this.myModule.then : <TResult1 = typeof "tests/cases/conformance/es2018/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/es2018/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>this.myModule : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>this : this
>myModule : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>then : <TResult1 = typeof "tests/cases/conformance/es2018/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/es2018/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>Zero => { console.log(Zero.foo()); } : (Zero: typeof "tests/cases/conformance/es2018/dynamicImport/0") => void
>Zero : typeof "tests/cases/conformance/es2018/dynamicImport/0"
console.log(Zero.foo());
>console.log(Zero.foo()) : any
>console.log : any
>console : any
>log : any
>Zero.foo() : string
>Zero.foo : () => string
>Zero : typeof "tests/cases/conformance/es2018/dynamicImport/0"
>foo : () => string
}, async err => {
>async err => { console.log(err); let one = await import("./1"); console.log(one.backup()); } : (err: any) => Promise<void>
>err : any
console.log(err);
>console.log(err) : any
>console.log : any
>console : any
>log : any
>err : any
let one = await import("./1");
>one : typeof "tests/cases/conformance/es2018/dynamicImport/1"
>await import("./1") : typeof "tests/cases/conformance/es2018/dynamicImport/1"
>import("./1") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/1">
>"./1" : "./1"
console.log(one.backup());
>console.log(one.backup()) : any
>console.log : any
>console : any
>log : any
>one.backup() : string
>one.backup : () => string
>one : typeof "tests/cases/conformance/es2018/dynamicImport/1"
>backup : () => string
});
}
}
@@ -0,0 +1,51 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpressionInUMD1.ts] ////
//// [0.ts]
export function foo() { return "foo"; }
//// [1.ts]
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
function foo() {
const p2 = import("./0");
}
//// [0.js]
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function foo() { return "foo"; }
exports.foo = foo;
});
//// [1.js]
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
require.length === 1 ? Promise.resolve().then(() => require("./0")) : new Promise(resolve => require(["./0"], resolve));
var p1 = require.length === 1 ? Promise.resolve().then(() => require("./0")) : new Promise(resolve => require(["./0"], resolve));
p1.then(zero => {
return zero.foo();
});
function foo() {
const p2 = require.length === 1 ? Promise.resolve().then(() => require("./0")) : new Promise(resolve => require(["./0"], resolve));
}
});
@@ -0,0 +1,28 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export function foo() { return "foo"; }
>foo : Symbol(foo, Decl(0.ts, 0, 0))
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
import("./0");
var p1 = import("./0");
>p1 : Symbol(p1, Decl(1.ts, 1, 3))
p1.then(zero => {
>p1.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p1 : Symbol(p1, Decl(1.ts, 1, 3))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>zero : Symbol(zero, Decl(1.ts, 2, 8))
return zero.foo();
>zero.foo : Symbol(foo, Decl(0.ts, 0, 0))
>zero : Symbol(zero, Decl(1.ts, 2, 8))
>foo : Symbol(foo, Decl(0.ts, 0, 0))
});
function foo() {
>foo : Symbol(foo, Decl(1.ts, 4, 3))
const p2 = import("./0");
>p2 : Symbol(p2, Decl(1.ts, 7, 9))
}
@@ -0,0 +1,39 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export function foo() { return "foo"; }
>foo : () => string
>"foo" : "foo"
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
import("./0");
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
var p1 = import("./0");
>p1 : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
p1.then(zero => {
>p1.then(zero => { return zero.foo();}) : Promise<string>
>p1.then : <TResult1 = typeof "tests/cases/conformance/es2018/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/es2018/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>p1 : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>then : <TResult1 = typeof "tests/cases/conformance/es2018/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/es2018/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>zero => { return zero.foo();} : (zero: typeof "tests/cases/conformance/es2018/dynamicImport/0") => string
>zero : typeof "tests/cases/conformance/es2018/dynamicImport/0"
return zero.foo();
>zero.foo() : string
>zero.foo : () => string
>zero : typeof "tests/cases/conformance/es2018/dynamicImport/0"
>foo : () => string
});
function foo() {
>foo : () => void
const p2 = import("./0");
>p2 : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
}
@@ -0,0 +1,55 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpressionInUMD2.ts] ////
//// [0.ts]
export class B {
print() { return "I am B"}
}
//// [2.ts]
// We use Promise<any> for now as there is no way to specify shape of module object
function foo(x: Promise<any>) {
x.then(value => {
let b = new value.B();
b.print();
})
}
foo(import("./0"));
//// [0.js]
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class B {
print() { return "I am B"; }
}
exports.B = B;
});
//// [2.js]
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
// We use Promise<any> for now as there is no way to specify shape of module object
function foo(x) {
x.then(value => {
let b = new value.B();
b.print();
});
}
foo(require.length === 1 ? Promise.resolve().then(() => require("./0")) : new Promise(resolve => require(["./0"], resolve)));
});
@@ -0,0 +1,34 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export class B {
>B : Symbol(B, Decl(0.ts, 0, 0))
print() { return "I am B"}
>print : Symbol(B.print, Decl(0.ts, 0, 16))
}
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
// We use Promise<any> for now as there is no way to specify shape of module object
function foo(x: Promise<any>) {
>foo : Symbol(foo, Decl(2.ts, 0, 0))
>x : Symbol(x, Decl(2.ts, 1, 13))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
x.then(value => {
>x.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(2.ts, 1, 13))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>value : Symbol(value, Decl(2.ts, 2, 11))
let b = new value.B();
>b : Symbol(b, Decl(2.ts, 3, 11))
>value : Symbol(value, Decl(2.ts, 2, 11))
b.print();
>b : Symbol(b, Decl(2.ts, 3, 11))
})
}
foo(import("./0"));
>foo : Symbol(foo, Decl(2.ts, 0, 0))
@@ -0,0 +1,46 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export class B {
>B : B
print() { return "I am B"}
>print : () => string
>"I am B" : "I am B"
}
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
// We use Promise<any> for now as there is no way to specify shape of module object
function foo(x: Promise<any>) {
>foo : (x: Promise<any>) => void
>x : Promise<any>
>Promise : Promise<T>
x.then(value => {
>x.then(value => { let b = new value.B(); b.print(); }) : Promise<void>
>x.then : <TResult1 = any, TResult2 = never>(onfulfilled?: (value: any) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>x : Promise<any>
>then : <TResult1 = any, TResult2 = never>(onfulfilled?: (value: any) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>value => { let b = new value.B(); b.print(); } : (value: any) => void
>value : any
let b = new value.B();
>b : any
>new value.B() : any
>value.B : any
>value : any
>B : any
b.print();
>b.print() : any
>b.print : any
>b : any
>print : any
})
}
foo(import("./0"));
>foo(import("./0")) : void
>foo : (x: Promise<any>) => void
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
@@ -0,0 +1,87 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpressionInUMD4.ts] ////
//// [0.ts]
export class B {
print() { return "I am B"}
}
export function foo() { return "foo" }
//// [1.ts]
export function backup() { return "backup"; }
//// [2.ts]
declare var console: any;
class C {
private myModule = import("./0");
method() {
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
console.log(err);
let one = await import("./1");
console.log(one.backup());
});
}
}
//// [0.js]
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class B {
print() { return "I am B"; }
}
exports.B = B;
function foo() { return "foo"; }
exports.foo = foo;
});
//// [1.js]
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function backup() { return "backup"; }
exports.backup = backup;
});
//// [2.js]
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
class C {
constructor() {
this.myModule = require.length === 1 ? Promise.resolve().then(() => require("./0")) : new Promise(resolve => require(["./0"], resolve));
}
method() {
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async (err) => {
console.log(err);
let one = await (require.length === 1 ? Promise.resolve().then(() => require("./1")) : new Promise(resolve => require(["./1"], resolve)));
console.log(one.backup());
});
}
}
});
@@ -0,0 +1,61 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export class B {
>B : Symbol(B, Decl(0.ts, 0, 0))
print() { return "I am B"}
>print : Symbol(B.print, Decl(0.ts, 0, 16))
}
export function foo() { return "foo" }
>foo : Symbol(foo, Decl(0.ts, 2, 1))
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
export function backup() { return "backup"; }
>backup : Symbol(backup, Decl(1.ts, 0, 0))
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
declare var console: any;
>console : Symbol(console, Decl(2.ts, 0, 11))
class C {
>C : Symbol(C, Decl(2.ts, 0, 25))
private myModule = import("./0");
>myModule : Symbol(C.myModule, Decl(2.ts, 1, 9))
method() {
>method : Symbol(C.method, Decl(2.ts, 2, 37))
this.myModule.then(Zero => {
>this.myModule.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>this.myModule : Symbol(C.myModule, Decl(2.ts, 1, 9))
>this : Symbol(C, Decl(2.ts, 0, 25))
>myModule : Symbol(C.myModule, Decl(2.ts, 1, 9))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Zero : Symbol(Zero, Decl(2.ts, 4, 27))
console.log(Zero.foo());
>console : Symbol(console, Decl(2.ts, 0, 11))
>Zero.foo : Symbol(foo, Decl(0.ts, 2, 1))
>Zero : Symbol(Zero, Decl(2.ts, 4, 27))
>foo : Symbol(foo, Decl(0.ts, 2, 1))
}, async err => {
>err : Symbol(err, Decl(2.ts, 6, 16))
console.log(err);
>console : Symbol(console, Decl(2.ts, 0, 11))
>err : Symbol(err, Decl(2.ts, 6, 16))
let one = await import("./1");
>one : Symbol(one, Decl(2.ts, 8, 15))
console.log(one.backup());
>console : Symbol(console, Decl(2.ts, 0, 11))
>one.backup : Symbol(backup, Decl(1.ts, 0, 0))
>one : Symbol(one, Decl(2.ts, 8, 15))
>backup : Symbol(backup, Decl(1.ts, 0, 0))
});
}
}
@@ -0,0 +1,83 @@
=== tests/cases/conformance/es2018/dynamicImport/0.ts ===
export class B {
>B : B
print() { return "I am B"}
>print : () => string
>"I am B" : "I am B"
}
export function foo() { return "foo" }
>foo : () => string
>"foo" : "foo"
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
export function backup() { return "backup"; }
>backup : () => string
>"backup" : "backup"
=== tests/cases/conformance/es2018/dynamicImport/2.ts ===
declare var console: any;
>console : any
class C {
>C : C
private myModule = import("./0");
>myModule : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>import("./0") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>"./0" : "./0"
method() {
>method : () => void
this.myModule.then(Zero => {
>this.myModule.then(Zero => { console.log(Zero.foo()); }, async err => { console.log(err); let one = await import("./1"); console.log(one.backup()); }) : Promise<void>
>this.myModule.then : <TResult1 = typeof "tests/cases/conformance/es2018/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/es2018/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>this.myModule : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>this : this
>myModule : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/0">
>then : <TResult1 = typeof "tests/cases/conformance/es2018/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/es2018/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>Zero => { console.log(Zero.foo()); } : (Zero: typeof "tests/cases/conformance/es2018/dynamicImport/0") => void
>Zero : typeof "tests/cases/conformance/es2018/dynamicImport/0"
console.log(Zero.foo());
>console.log(Zero.foo()) : any
>console.log : any
>console : any
>log : any
>Zero.foo() : string
>Zero.foo : () => string
>Zero : typeof "tests/cases/conformance/es2018/dynamicImport/0"
>foo : () => string
}, async err => {
>async err => { console.log(err); let one = await import("./1"); console.log(one.backup()); } : (err: any) => Promise<void>
>err : any
console.log(err);
>console.log(err) : any
>console.log : any
>console : any
>log : any
>err : any
let one = await import("./1");
>one : typeof "tests/cases/conformance/es2018/dynamicImport/1"
>await import("./1") : typeof "tests/cases/conformance/es2018/dynamicImport/1"
>import("./1") : Promise<typeof "tests/cases/conformance/es2018/dynamicImport/1">
>"./1" : "./1"
console.log(one.backup());
>console.log(one.backup()) : any
>console.log : any
>console : any
>log : any
>one.backup() : string
>one.backup : () => string
>one : typeof "tests/cases/conformance/es2018/dynamicImport/1"
>backup : () => string
});
}
}
@@ -0,0 +1,61 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpressionReturnPromiseOfAny.ts] ////
//// [defaultPath.ts]
export class C {}
//// [1.ts]
import * as defaultModule from "./defaultPath";
declare function getSpecifier(): string;
declare function ValidSomeCondition(): boolean;
declare var whatToLoad: boolean;
declare const directory: string;
declare const moduleFile: number;
import(`${directory}\${moduleFile}`);
import(getSpecifier());
var p1 = import(ValidSomeCondition() ? "./0" : "externalModule");
var p1: Promise<any> = import(getSpecifier());
var p11: Promise<typeof defaultModule> = import(getSpecifier());
const p2 = import(whatToLoad ? getSpecifier() : "defaulPath") as Promise<typeof defaultModule>;
p1.then(zero => {
return zero.foo(); // ok, zero is any
});
let j: string;
var p3: Promise<typeof defaultModule> = import(j=getSpecifier());
function * loadModule(directories: string[]) {
for (const directory of directories) {
const path = `${directory}\moduleFile`;
import(yield path);
}
}
//// [defaultPath.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class C {
}
exports.C = C;
//// [1.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
Promise.resolve().then(() => require(`${directory}\${moduleFile}`));
Promise.resolve().then(() => require(getSpecifier()));
var p1 = Promise.resolve().then(() => require(ValidSomeCondition() ? "./0" : "externalModule"));
var p1 = Promise.resolve().then(() => require(getSpecifier()));
var p11 = Promise.resolve().then(() => require(getSpecifier()));
const p2 = Promise.resolve().then(() => require(whatToLoad ? getSpecifier() : "defaulPath"));
p1.then(zero => {
return zero.foo(); // ok, zero is any
});
let j;
var p3 = Promise.resolve().then(() => require(j = getSpecifier()));
function* loadModule(directories) {
for (const directory of directories) {
const path = `${directory}\moduleFile`;
Promise.resolve().then(() => require(yield path));
}
}
@@ -0,0 +1,89 @@
=== tests/cases/conformance/es2018/dynamicImport/defaultPath.ts ===
export class C {}
>C : Symbol(C, Decl(defaultPath.ts, 0, 0))
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
import * as defaultModule from "./defaultPath";
>defaultModule : Symbol(defaultModule, Decl(1.ts, 0, 6))
declare function getSpecifier(): string;
>getSpecifier : Symbol(getSpecifier, Decl(1.ts, 0, 47))
declare function ValidSomeCondition(): boolean;
>ValidSomeCondition : Symbol(ValidSomeCondition, Decl(1.ts, 1, 40))
declare var whatToLoad: boolean;
>whatToLoad : Symbol(whatToLoad, Decl(1.ts, 3, 11))
declare const directory: string;
>directory : Symbol(directory, Decl(1.ts, 4, 13))
declare const moduleFile: number;
>moduleFile : Symbol(moduleFile, Decl(1.ts, 5, 13))
import(`${directory}\${moduleFile}`);
>directory : Symbol(directory, Decl(1.ts, 4, 13))
import(getSpecifier());
>getSpecifier : Symbol(getSpecifier, Decl(1.ts, 0, 47))
var p1 = import(ValidSomeCondition() ? "./0" : "externalModule");
>p1 : Symbol(p1, Decl(1.ts, 10, 3), Decl(1.ts, 11, 3))
>ValidSomeCondition : Symbol(ValidSomeCondition, Decl(1.ts, 1, 40))
var p1: Promise<any> = import(getSpecifier());
>p1 : Symbol(p1, Decl(1.ts, 10, 3), Decl(1.ts, 11, 3))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>getSpecifier : Symbol(getSpecifier, Decl(1.ts, 0, 47))
var p11: Promise<typeof defaultModule> = import(getSpecifier());
>p11 : Symbol(p11, Decl(1.ts, 12, 3))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>defaultModule : Symbol(defaultModule, Decl(1.ts, 0, 6))
>getSpecifier : Symbol(getSpecifier, Decl(1.ts, 0, 47))
const p2 = import(whatToLoad ? getSpecifier() : "defaulPath") as Promise<typeof defaultModule>;
>p2 : Symbol(p2, Decl(1.ts, 13, 5))
>whatToLoad : Symbol(whatToLoad, Decl(1.ts, 3, 11))
>getSpecifier : Symbol(getSpecifier, Decl(1.ts, 0, 47))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>defaultModule : Symbol(defaultModule, Decl(1.ts, 0, 6))
p1.then(zero => {
>p1.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p1 : Symbol(p1, Decl(1.ts, 10, 3), Decl(1.ts, 11, 3))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>zero : Symbol(zero, Decl(1.ts, 14, 8))
return zero.foo(); // ok, zero is any
>zero : Symbol(zero, Decl(1.ts, 14, 8))
});
let j: string;
>j : Symbol(j, Decl(1.ts, 18, 3))
var p3: Promise<typeof defaultModule> = import(j=getSpecifier());
>p3 : Symbol(p3, Decl(1.ts, 19, 3))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>defaultModule : Symbol(defaultModule, Decl(1.ts, 0, 6))
>j : Symbol(j, Decl(1.ts, 18, 3))
>getSpecifier : Symbol(getSpecifier, Decl(1.ts, 0, 47))
function * loadModule(directories: string[]) {
>loadModule : Symbol(loadModule, Decl(1.ts, 19, 65))
>directories : Symbol(directories, Decl(1.ts, 21, 22))
for (const directory of directories) {
>directory : Symbol(directory, Decl(1.ts, 22, 14))
>directories : Symbol(directories, Decl(1.ts, 21, 22))
const path = `${directory}\moduleFile`;
>path : Symbol(path, Decl(1.ts, 23, 13))
>directory : Symbol(directory, Decl(1.ts, 22, 14))
import(yield path);
>path : Symbol(path, Decl(1.ts, 23, 13))
}
}
@@ -0,0 +1,118 @@
=== tests/cases/conformance/es2018/dynamicImport/defaultPath.ts ===
export class C {}
>C : C
=== tests/cases/conformance/es2018/dynamicImport/1.ts ===
import * as defaultModule from "./defaultPath";
>defaultModule : typeof defaultModule
declare function getSpecifier(): string;
>getSpecifier : () => string
declare function ValidSomeCondition(): boolean;
>ValidSomeCondition : () => boolean
declare var whatToLoad: boolean;
>whatToLoad : boolean
declare const directory: string;
>directory : string
declare const moduleFile: number;
>moduleFile : number
import(`${directory}\${moduleFile}`);
>import(`${directory}\${moduleFile}`) : Promise<any>
>`${directory}\${moduleFile}` : string
>directory : string
import(getSpecifier());
>import(getSpecifier()) : Promise<any>
>getSpecifier() : string
>getSpecifier : () => string
var p1 = import(ValidSomeCondition() ? "./0" : "externalModule");
>p1 : Promise<any>
>import(ValidSomeCondition() ? "./0" : "externalModule") : Promise<any>
>ValidSomeCondition() ? "./0" : "externalModule" : "./0" | "externalModule"
>ValidSomeCondition() : boolean
>ValidSomeCondition : () => boolean
>"./0" : "./0"
>"externalModule" : "externalModule"
var p1: Promise<any> = import(getSpecifier());
>p1 : Promise<any>
>Promise : Promise<T>
>import(getSpecifier()) : Promise<any>
>getSpecifier() : string
>getSpecifier : () => string
var p11: Promise<typeof defaultModule> = import(getSpecifier());
>p11 : Promise<typeof defaultModule>
>Promise : Promise<T>
>defaultModule : typeof defaultModule
>import(getSpecifier()) : Promise<any>
>getSpecifier() : string
>getSpecifier : () => string
const p2 = import(whatToLoad ? getSpecifier() : "defaulPath") as Promise<typeof defaultModule>;
>p2 : Promise<typeof defaultModule>
>import(whatToLoad ? getSpecifier() : "defaulPath") as Promise<typeof defaultModule> : Promise<typeof defaultModule>
>import(whatToLoad ? getSpecifier() : "defaulPath") : Promise<any>
>whatToLoad ? getSpecifier() : "defaulPath" : string
>whatToLoad : boolean
>getSpecifier() : string
>getSpecifier : () => string
>"defaulPath" : "defaulPath"
>Promise : Promise<T>
>defaultModule : typeof defaultModule
p1.then(zero => {
>p1.then(zero => { return zero.foo(); // ok, zero is any}) : Promise<any>
>p1.then : <TResult1 = any, TResult2 = never>(onfulfilled?: (value: any) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>p1 : Promise<any>
>then : <TResult1 = any, TResult2 = never>(onfulfilled?: (value: any) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>zero => { return zero.foo(); // ok, zero is any} : (zero: any) => any
>zero : any
return zero.foo(); // ok, zero is any
>zero.foo() : any
>zero.foo : any
>zero : any
>foo : any
});
let j: string;
>j : string
var p3: Promise<typeof defaultModule> = import(j=getSpecifier());
>p3 : Promise<typeof defaultModule>
>Promise : Promise<T>
>defaultModule : typeof defaultModule
>import(j=getSpecifier()) : Promise<any>
>j=getSpecifier() : string
>j : string
>getSpecifier() : string
>getSpecifier : () => string
function * loadModule(directories: string[]) {
>loadModule : (directories: string[]) => IterableIterator<string>
>directories : string[]
for (const directory of directories) {
>directory : string
>directories : string[]
const path = `${directory}\moduleFile`;
>path : string
>`${directory}\moduleFile` : string
>directory : string
import(yield path);
>import(yield path) : Promise<any>
>yield path : any
>path : string
}
}
@@ -0,0 +1,32 @@
tests/cases/conformance/es2018/dynamicImport/importCallExpressionSpecifierNotStringTypeError.ts(6,8): error TS7035: Dynamic import's specifier must be of type 'string', but here has type 'boolean'.
tests/cases/conformance/es2018/dynamicImport/importCallExpressionSpecifierNotStringTypeError.ts(7,17): error TS7035: Dynamic import's specifier must be of type 'string', but here has type 'boolean'.
tests/cases/conformance/es2018/dynamicImport/importCallExpressionSpecifierNotStringTypeError.ts(8,19): error TS7035: Dynamic import's specifier must be of type 'string', but here has type 'boolean | "defaulPath"'.
tests/cases/conformance/es2018/dynamicImport/importCallExpressionSpecifierNotStringTypeError.ts(13,17): error TS7035: Dynamic import's specifier must be of type 'string', but here has type 'string[]'.
tests/cases/conformance/es2018/dynamicImport/importCallExpressionSpecifierNotStringTypeError.ts(14,17): error TS7035: Dynamic import's specifier must be of type 'string', but here has type '() => string'.
==== tests/cases/conformance/es2018/dynamicImport/importCallExpressionSpecifierNotStringTypeError.ts (5 errors) ====
declare function getSpecifier(): boolean;
declare var whatToLoad: boolean;
// Error specifier is not assignable to string
import(getSpecifier());
~~~~~~~~~~~~~~
!!! error TS7035: Dynamic import's specifier must be of type 'string', but here has type 'boolean'.
var p1 = import(getSpecifier());
~~~~~~~~~~~~~~
!!! error TS7035: Dynamic import's specifier must be of type 'string', but here has type 'boolean'.
const p2 = import(whatToLoad ? getSpecifier() : "defaulPath")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS7035: Dynamic import's specifier must be of type 'string', but here has type 'boolean | "defaulPath"'.
p1.then(zero => {
return zero.foo(); // ok, zero is any
});
var p3 = import(["path1", "path2"]);
~~~~~~~~~~~~~~~~~~
!!! error TS7035: Dynamic import's specifier must be of type 'string', but here has type 'string[]'.
var p4 = import(()=>"PathToModule");
~~~~~~~~~~~~~~~~~~
!!! error TS7035: Dynamic import's specifier must be of type 'string', but here has type '() => string'.
@@ -0,0 +1,27 @@
//// [importCallExpressionSpecifierNotStringTypeError.ts]
declare function getSpecifier(): boolean;
declare var whatToLoad: boolean;
// Error specifier is not assignable to string
import(getSpecifier());
var p1 = import(getSpecifier());
const p2 = import(whatToLoad ? getSpecifier() : "defaulPath")
p1.then(zero => {
return zero.foo(); // ok, zero is any
});
var p3 = import(["path1", "path2"]);
var p4 = import(()=>"PathToModule");
//// [importCallExpressionSpecifierNotStringTypeError.js]
"use strict";
// Error specifier is not assignable to string
Promise.resolve().then(() => require(getSpecifier()));
var p1 = Promise.resolve().then(() => require(getSpecifier()));
const p2 = Promise.resolve().then(() => require(whatToLoad ? getSpecifier() : "defaulPath"));
p1.then(zero => {
return zero.foo(); // ok, zero is any
});
var p3 = Promise.resolve().then(() => require(["path1", "path2"]));
var p4 = Promise.resolve().then(() => require(() => "PathToModule"));
@@ -0,0 +1,19 @@
tests/cases/conformance/es2018/dynamicImport/1.ts(2,10): error TS1323: Dynamic import cannot have type arguments
tests/cases/conformance/es2018/dynamicImport/1.ts(3,10): error TS1323: Dynamic import cannot have type arguments
==== tests/cases/conformance/es2018/dynamicImport/0.ts (0 errors) ====
export function foo() { return "foo"; }
==== tests/cases/conformance/es2018/dynamicImport/1.ts (2 errors) ====
"use strict"
var p1 = import<Promise<any>>("./0"); // error
~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1323: Dynamic import cannot have type arguments
var p2 = import<>("./0"); // error
~~~~~~~~~~~~~~~
!!! error TS1323: Dynamic import cannot have type arguments
// p1.then(value => {
// value.anyFunction();
// })
@@ -0,0 +1,26 @@
//// [tests/cases/conformance/es2018/dynamicImport/importCallExpressionWithTypeArgument.ts] ////
//// [0.ts]
export function foo() { return "foo"; }
//// [1.ts]
"use strict"
var p1 = import<Promise<any>>("./0"); // error
var p2 = import<>("./0"); // error
// p1.then(value => {
// value.anyFunction();
// })
//// [0.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function foo() { return "foo"; }
exports.foo = foo;
//// [1.js]
"use strict";
var p1 = (import)("./0"); // error
var p2 = (import)("./0"); // error
// p1.then(value => {
// value.anyFunction();
// })