Add declaration emit test and test to make sure we don't give dynamic import implicit "use strict"

This commit is contained in:
Kanchalai Tanglertsampan
2017-03-23 11:29:45 -07:00
parent c62f4f5888
commit e1ba8553b6
4 changed files with 50 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
// @module: commonjs
// @target: es6
// @noImplicitAny: false
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
var p1 = import("./0");
function arguments() { } // this is allow as the file doesn't have implicit "use strict"

View File

@@ -0,0 +1,11 @@
// @module: commonjs
// @target: es6
// @noImplicitAny: false
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
"use strict"
var p1 = import("./0");
function arguments() { }

View File

@@ -0,0 +1,19 @@
// @module: commonjs
// @target: es6
// @noImplicitAny: false
// @declaration: true
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);
}

View File

@@ -0,0 +1,10 @@
// @module: es2018
// @target: esnext
// @declaration: true
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
import("./0");
var p1 = import("./0");