Skip to content

Commit 302db0a

Browse files
committed
Merge pull request microsoft#5272 from Microsoft/es2015-target
Add ES2015 as a synonym to ES6
2 parents d703e09 + 53188d9 commit 302db0a

14 files changed

+229
-2
lines changed

src/compiler/commandLineParser.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ namespace ts {
7777
"system": ModuleKind.System,
7878
"umd": ModuleKind.UMD,
7979
"es6": ModuleKind.ES6,
80+
"es2015": ModuleKind.ES2015,
8081
},
8182
description: Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es6,
8283
paramType: Diagnostics.KIND,
@@ -205,7 +206,12 @@ namespace ts {
205206
{
206207
name: "target",
207208
shortName: "t",
208-
type: { "es3": ScriptTarget.ES3, "es5": ScriptTarget.ES5, "es6": ScriptTarget.ES6 },
209+
type: {
210+
"es3": ScriptTarget.ES3,
211+
"es5": ScriptTarget.ES5,
212+
"es6": ScriptTarget.ES6,
213+
"es2015": ScriptTarget.ES2015,
214+
},
209215
description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental,
210216
paramType: Diagnostics.VERSION,
211217
error: Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES6

src/compiler/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2103,6 +2103,7 @@ namespace ts {
21032103
UMD = 3,
21042104
System = 4,
21052105
ES6 = 5,
2106+
ES2015 = ES6,
21062107
}
21072108

21082109
export const enum JsxEmit {
@@ -2128,12 +2129,13 @@ namespace ts {
21282129
ES3 = 0,
21292130
ES5 = 1,
21302131
ES6 = 2,
2132+
ES2015 = ES6,
21312133
Latest = ES6,
21322134
}
21332135

21342136
export const enum LanguageVariant {
21352137
Standard,
2136-
JSX
2138+
JSX,
21372139
}
21382140

21392141
export interface ParsedCommandLine {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//// [es2015modulekind.ts]
2+
3+
export default class A
4+
{
5+
constructor ()
6+
{
7+
8+
}
9+
10+
public B()
11+
{
12+
return 42;
13+
}
14+
}
15+
16+
//// [es2015modulekind.js]
17+
export default class A {
18+
constructor() {
19+
}
20+
B() {
21+
return 42;
22+
}
23+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
=== tests/cases/compiler/es2015modulekind.ts ===
2+
3+
export default class A
4+
>A : Symbol(A, Decl(es2015modulekind.ts, 0, 0))
5+
{
6+
constructor ()
7+
{
8+
9+
}
10+
11+
public B()
12+
>B : Symbol(B, Decl(es2015modulekind.ts, 6, 5))
13+
{
14+
return 42;
15+
}
16+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
=== tests/cases/compiler/es2015modulekind.ts ===
2+
3+
export default class A
4+
>A : A
5+
{
6+
constructor ()
7+
{
8+
9+
}
10+
11+
public B()
12+
>B : () => number
13+
{
14+
return 42;
15+
>42 : number
16+
}
17+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//// [es2015modulekindWithES6Target.ts]
2+
3+
export default class A
4+
{
5+
constructor ()
6+
{
7+
8+
}
9+
10+
public B()
11+
{
12+
return 42;
13+
}
14+
}
15+
16+
//// [es2015modulekindWithES6Target.js]
17+
export default class A {
18+
constructor() {
19+
}
20+
B() {
21+
return 42;
22+
}
23+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
=== tests/cases/compiler/es2015modulekindWithES6Target.ts ===
2+
3+
export default class A
4+
>A : Symbol(A, Decl(es2015modulekindWithES6Target.ts, 0, 0))
5+
{
6+
constructor ()
7+
{
8+
9+
}
10+
11+
public B()
12+
>B : Symbol(B, Decl(es2015modulekindWithES6Target.ts, 6, 5))
13+
{
14+
return 42;
15+
}
16+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
=== tests/cases/compiler/es2015modulekindWithES6Target.ts ===
2+
3+
export default class A
4+
>A : A
5+
{
6+
constructor ()
7+
{
8+
9+
}
10+
11+
public B()
12+
>B : () => number
13+
{
14+
return 42;
15+
>42 : number
16+
}
17+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//// [es6modulekindWithES2015Target.ts]
2+
3+
export default class A
4+
{
5+
constructor ()
6+
{
7+
8+
}
9+
10+
public B()
11+
{
12+
return 42;
13+
}
14+
}
15+
16+
//// [es6modulekindWithES2015Target.js]
17+
export default class A {
18+
constructor() {
19+
}
20+
B() {
21+
return 42;
22+
}
23+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
=== tests/cases/compiler/es6modulekindWithES2015Target.ts ===
2+
3+
export default class A
4+
>A : Symbol(A, Decl(es6modulekindWithES2015Target.ts, 0, 0))
5+
{
6+
constructor ()
7+
{
8+
9+
}
10+
11+
public B()
12+
>B : Symbol(B, Decl(es6modulekindWithES2015Target.ts, 6, 5))
13+
{
14+
return 42;
15+
}
16+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
=== tests/cases/compiler/es6modulekindWithES2015Target.ts ===
2+
3+
export default class A
4+
>A : A
5+
{
6+
constructor ()
7+
{
8+
9+
}
10+
11+
public B()
12+
>B : () => number
13+
{
14+
return 42;
15+
>42 : number
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// @target: es2015
2+
// @sourcemap: false
3+
// @declaration: false
4+
// @module: es2015
5+
6+
export default class A
7+
{
8+
constructor ()
9+
{
10+
11+
}
12+
13+
public B()
14+
{
15+
return 42;
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// @target: es6
2+
// @sourcemap: false
3+
// @declaration: false
4+
// @module: es2015
5+
6+
export default class A
7+
{
8+
constructor ()
9+
{
10+
11+
}
12+
13+
public B()
14+
{
15+
return 42;
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// @target: es2015
2+
// @sourcemap: false
3+
// @declaration: false
4+
// @module: es6
5+
6+
export default class A
7+
{
8+
constructor ()
9+
{
10+
11+
}
12+
13+
public B()
14+
{
15+
return 42;
16+
}
17+
}

0 commit comments

Comments
 (0)