mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-07-07 18:25:51 -05:00
Merge pull request #9042 from Microsoft/ES6ModulesES5Target
Fix #6319: Add support for `--t: es5` and `--m es6`
This commit is contained in:
22
tests/cases/compiler/es6modulekindWithES5Target.ts
Normal file
22
tests/cases/compiler/es6modulekindWithES5Target.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
// @experimentalDecorators: true
|
||||
|
||||
export class C {
|
||||
static s = 0;
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
export { C as C2 };
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
@foo
|
||||
export class D {
|
||||
static s = 0;
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
export { D as D2 };
|
||||
|
||||
class E { }
|
||||
export {E};
|
||||
9
tests/cases/compiler/es6modulekindWithES5Target10.ts
Normal file
9
tests/cases/compiler/es6modulekindWithES5Target10.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
|
||||
import i = require("mod"); // Error;
|
||||
|
||||
|
||||
namespace N {
|
||||
}
|
||||
export = N; // Error
|
||||
12
tests/cases/compiler/es6modulekindWithES5Target11.ts
Normal file
12
tests/cases/compiler/es6modulekindWithES5Target11.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
// @experimentalDecorators: true
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
@foo
|
||||
export default class C {
|
||||
static x() { return C.y; }
|
||||
static y = 1
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
8
tests/cases/compiler/es6modulekindWithES5Target2.ts
Normal file
8
tests/cases/compiler/es6modulekindWithES5Target2.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
|
||||
export default class C {
|
||||
static s = 0;
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
12
tests/cases/compiler/es6modulekindWithES5Target3.ts
Normal file
12
tests/cases/compiler/es6modulekindWithES5Target3.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
// @experimentalDecorators: true
|
||||
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
@foo
|
||||
export default class D {
|
||||
static s = 0;
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
5
tests/cases/compiler/es6modulekindWithES5Target4.ts
Normal file
5
tests/cases/compiler/es6modulekindWithES5Target4.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
|
||||
class E { }
|
||||
export default E;
|
||||
11
tests/cases/compiler/es6modulekindWithES5Target5.ts
Normal file
11
tests/cases/compiler/es6modulekindWithES5Target5.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
// @preserveConstEnums: true
|
||||
|
||||
export enum E1 {
|
||||
value1
|
||||
}
|
||||
|
||||
export const enum E2 {
|
||||
value1
|
||||
}
|
||||
11
tests/cases/compiler/es6modulekindWithES5Target6.ts
Normal file
11
tests/cases/compiler/es6modulekindWithES5Target6.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
|
||||
export function f1(d = 0) {
|
||||
}
|
||||
|
||||
export function f2(...arg) {
|
||||
}
|
||||
|
||||
export default function f3(d = 0) {
|
||||
}
|
||||
10
tests/cases/compiler/es6modulekindWithES5Target7.ts
Normal file
10
tests/cases/compiler/es6modulekindWithES5Target7.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
|
||||
export namespace N {
|
||||
var x = 0;
|
||||
}
|
||||
|
||||
export namespace N2 {
|
||||
export interface I { }
|
||||
}
|
||||
5
tests/cases/compiler/es6modulekindWithES5Target8.ts
Normal file
5
tests/cases/compiler/es6modulekindWithES5Target8.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
|
||||
export const c = 0;
|
||||
export let l = 1;
|
||||
20
tests/cases/compiler/es6modulekindWithES5Target9.ts
Normal file
20
tests/cases/compiler/es6modulekindWithES5Target9.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
|
||||
import d from "mod";
|
||||
|
||||
import {a} from "mod";
|
||||
|
||||
import * as M from "mod";
|
||||
|
||||
export {a};
|
||||
|
||||
export {M};
|
||||
|
||||
export {d};
|
||||
|
||||
export * from "mod";
|
||||
|
||||
export {b} from "mod"
|
||||
|
||||
export default d;
|
||||
Reference in New Issue
Block a user