mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 10:46:28 -05:00
Add declaration emit test and test to make sure we don't give dynamic import implicit "use strict"
This commit is contained in:
@@ -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"
|
||||
@@ -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() { }
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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");
|
||||
Reference in New Issue
Block a user