mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 10:46:28 -05:00
Add more tests for emitting of es2018 module-kind
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
// @module: es2018
|
||||
// @target: esnext
|
||||
// @filename: 0.ts
|
||||
export class B {
|
||||
print() { return "I am B"}
|
||||
}
|
||||
|
||||
// @filename: 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,0 +1,14 @@
|
||||
// @module: es2018
|
||||
// @target: esnext
|
||||
// @filename: 0.ts
|
||||
export class B {
|
||||
print() { return "I am B"}
|
||||
}
|
||||
|
||||
// @filename: 2.ts
|
||||
async function foo() {
|
||||
class C extends (await import("./0")).B {}
|
||||
var c = new C();
|
||||
c.print();
|
||||
}
|
||||
foo();
|
||||
@@ -0,0 +1,26 @@
|
||||
// @module: es2018
|
||||
// @target: esnext
|
||||
// @filename: 0.ts
|
||||
export class B {
|
||||
print() { return "I am B"}
|
||||
}
|
||||
|
||||
export function foo() { return "foo" }
|
||||
|
||||
// @filename: 1.ts
|
||||
export function backup() { return "backup"; }
|
||||
|
||||
// @filename: 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());
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user