Skip to content

Commit 12003e5

Browse files
author
Orta Therox
authored
Default tsc --init to es2016 (#45934)
1 parent 90e83ad commit 12003e5

File tree

15 files changed

+445
-134
lines changed

15 files changed

+445
-134
lines changed

src/compiler/commandLineParser.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,7 @@ namespace ts {
13371337
/* @internal */
13381338
export const defaultInitCompilerOptions: CompilerOptions = {
13391339
module: ModuleKind.CommonJS,
1340-
target: ScriptTarget.ES5,
1340+
target: ScriptTarget.ES2016,
13411341
strict: true,
13421342
esModuleInterop: true,
13431343
forceConsistentCasingInFileNames: true,

tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
1212

1313
/* Language and Environment */
14-
"target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
14+
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
1515
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
1616
// "jsx": "preserve", /* Specify what JSX code is generated. */
1717
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */

tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
1212

1313
/* Language and Environment */
14-
"target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
14+
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
1515
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
1616
// "jsx": "preserve", /* Specify what JSX code is generated. */
1717
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */

tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
1212

1313
/* Language and Environment */
14-
"target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
14+
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
1515
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
1616
// "jsx": "preserve", /* Specify what JSX code is generated. */
1717
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */

tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
1212

1313
/* Language and Environment */
14-
"target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
14+
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
1515
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
1616
// "jsx": "preserve", /* Specify what JSX code is generated. */
1717
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */

tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
1212

1313
/* Language and Environment */
14-
"target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
14+
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
1515
"lib": ["es5","es2015.promise"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
1616
// "jsx": "preserve", /* Specify what JSX code is generated. */
1717
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */

tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
1212

1313
/* Language and Environment */
14-
"target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
14+
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
1515
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
1616
// "jsx": "preserve", /* Specify what JSX code is generated. */
1717
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */

tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
1212

1313
/* Language and Environment */
14-
"target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
14+
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
1515
"lib": ["es5","es2015.core"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
1616
// "jsx": "preserve", /* Specify what JSX code is generated. */
1717
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */

tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
1212

1313
/* Language and Environment */
14-
"target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
14+
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
1515
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
1616
// "jsx": "preserve", /* Specify what JSX code is generated. */
1717
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */

tests/baselines/reference/tscWatch/programUpdates/should-not-trigger-recompilation-because-of-program-emit/declarationDir-is-specified.js

+73-22
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ interface Array<T> { length: number; [n: number]: T; }
3232
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
3333

3434
/* Language and Environment */
35-
"target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
35+
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
3636
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
3737
// "jsx": "preserve", /* Specify what JSX code is generated. */
3838
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
@@ -128,25 +128,49 @@ Output::
128128
>> Screen clear
129129
[12:00:25 AM] Starting compilation in watch mode...
130130

131-
[12:00:40 AM] Found 0 errors. Watching for file changes.
131+
error TS2318: Cannot find global type 'Array'.
132+
133+
error TS2318: Cannot find global type 'Boolean'.
134+
135+
error TS2318: Cannot find global type 'CallableFunction'.
136+
137+
error TS2318: Cannot find global type 'Function'.
138+
139+
error TS2318: Cannot find global type 'IArguments'.
140+
141+
error TS2318: Cannot find global type 'NewableFunction'.
142+
143+
error TS2318: Cannot find global type 'Number'.
144+
145+
error TS2318: Cannot find global type 'Object'.
146+
147+
error TS2318: Cannot find global type 'RegExp'.
148+
149+
error TS2318: Cannot find global type 'String'.
150+
151+
error TS6053: File '/a/lib/lib.es2016.full.d.ts' not found.
152+
The file is in the program because:
153+
Default library for target 'es2016'
154+
155+
tsconfig.json:14:15
156+
14 "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
157+
   ~~~~~~~~
158+
File is default library for target specified here.
159+
160+
[12:00:40 AM] Found 11 errors. Watching for file changes.
132161

133162

134163

135164
Program root files: ["/user/username/projects/myproject/file1.ts","/user/username/projects/myproject/src/file2.ts"]
136-
Program options: {"target":1,"module":2,"declaration":true,"declarationDir":"/user/username/projects/myproject/decls","esModuleInterop":true,"forceConsistentCasingInFileNames":true,"strict":true,"skipLibCheck":true,"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"}
165+
Program options: {"target":3,"module":2,"declaration":true,"declarationDir":"/user/username/projects/myproject/decls","esModuleInterop":true,"forceConsistentCasingInFileNames":true,"strict":true,"skipLibCheck":true,"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"}
137166
Program structureReused: Not
138167
Program files::
139-
/a/lib/lib.d.ts
140168
/user/username/projects/myproject/file1.ts
141169
/user/username/projects/myproject/src/file2.ts
142170

143-
Semantic diagnostics in builder refreshed for::
144-
/a/lib/lib.d.ts
145-
/user/username/projects/myproject/file1.ts
146-
/user/username/projects/myproject/src/file2.ts
171+
No cached semantic diagnostics in the builder::
147172

148173
Shape signatures in builder refreshed for::
149-
/a/lib/lib.d.ts (used version)
150174
/user/username/projects/myproject/file1.ts (used version)
151175
/user/username/projects/myproject/src/file2.ts (used version)
152176

@@ -157,8 +181,8 @@ WatchedFiles::
157181
{"fileName":"/user/username/projects/myproject/file1.ts","pollingInterval":250}
158182
/user/username/projects/myproject/src/file2.ts:
159183
{"fileName":"/user/username/projects/myproject/src/file2.ts","pollingInterval":250}
160-
/a/lib/lib.d.ts:
161-
{"fileName":"/a/lib/lib.d.ts","pollingInterval":250}
184+
/a/lib/lib.es2016.full.d.ts:
185+
{"fileName":"/a/lib/lib.es2016.full.d.ts","pollingInterval":250}
162186

163187
FsWatches::
164188

@@ -212,8 +236,8 @@ WatchedFiles::
212236
{"fileName":"/user/username/projects/myproject/file1.ts","pollingInterval":250}
213237
/user/username/projects/myproject/src/file2.ts:
214238
{"fileName":"/user/username/projects/myproject/src/file2.ts","pollingInterval":250}
215-
/a/lib/lib.d.ts:
216-
{"fileName":"/a/lib/lib.d.ts","pollingInterval":250}
239+
/a/lib/lib.es2016.full.d.ts:
240+
{"fileName":"/a/lib/lib.es2016.full.d.ts","pollingInterval":250}
217241

218242
FsWatches::
219243

@@ -239,21 +263,48 @@ Output::
239263
>> Screen clear
240264
[12:00:43 AM] File change detected. Starting incremental compilation...
241265

242-
[12:00:48 AM] Found 0 errors. Watching for file changes.
266+
error TS2318: Cannot find global type 'Array'.
267+
268+
error TS2318: Cannot find global type 'Boolean'.
269+
270+
error TS2318: Cannot find global type 'CallableFunction'.
271+
272+
error TS2318: Cannot find global type 'Function'.
273+
274+
error TS2318: Cannot find global type 'IArguments'.
275+
276+
error TS2318: Cannot find global type 'NewableFunction'.
277+
278+
error TS2318: Cannot find global type 'Number'.
279+
280+
error TS2318: Cannot find global type 'Object'.
281+
282+
error TS2318: Cannot find global type 'RegExp'.
283+
284+
error TS2318: Cannot find global type 'String'.
285+
286+
error TS6053: File '/a/lib/lib.es2016.full.d.ts' not found.
287+
The file is in the program because:
288+
Default library for target 'es2016'
289+
290+
tsconfig.json:14:15
291+
14 "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
292+
   ~~~~~~~~
293+
File is default library for target specified here.
294+
295+
[12:00:48 AM] Found 11 errors. Watching for file changes.
243296

244297

245298

246299
Program root files: ["/user/username/projects/myproject/file1.ts","/user/username/projects/myproject/src/file2.ts","/user/username/projects/myproject/src/file3.ts"]
247-
Program options: {"target":1,"module":2,"declaration":true,"declarationDir":"/user/username/projects/myproject/decls","esModuleInterop":true,"forceConsistentCasingInFileNames":true,"strict":true,"skipLibCheck":true,"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"}
300+
Program options: {"target":3,"module":2,"declaration":true,"declarationDir":"/user/username/projects/myproject/decls","esModuleInterop":true,"forceConsistentCasingInFileNames":true,"strict":true,"skipLibCheck":true,"watch":true,"project":"/user/username/projects/myproject/tsconfig.json","configFilePath":"/user/username/projects/myproject/tsconfig.json"}
248301
Program structureReused: Not
249302
Program files::
250-
/a/lib/lib.d.ts
251303
/user/username/projects/myproject/file1.ts
252304
/user/username/projects/myproject/src/file2.ts
253305
/user/username/projects/myproject/src/file3.ts
254306

255-
Semantic diagnostics in builder refreshed for::
256-
/user/username/projects/myproject/src/file3.ts
307+
No cached semantic diagnostics in the builder::
257308

258309
Shape signatures in builder refreshed for::
259310
/user/username/projects/myproject/src/file3.ts (computed .d.ts)
@@ -265,8 +316,8 @@ WatchedFiles::
265316
{"fileName":"/user/username/projects/myproject/file1.ts","pollingInterval":250}
266317
/user/username/projects/myproject/src/file2.ts:
267318
{"fileName":"/user/username/projects/myproject/src/file2.ts","pollingInterval":250}
268-
/a/lib/lib.d.ts:
269-
{"fileName":"/a/lib/lib.d.ts","pollingInterval":250}
319+
/a/lib/lib.es2016.full.d.ts:
320+
{"fileName":"/a/lib/lib.es2016.full.d.ts","pollingInterval":250}
270321
/user/username/projects/myproject/src/file3.ts:
271322
{"fileName":"/user/username/projects/myproject/src/file3.ts","pollingInterval":250}
272323

@@ -309,8 +360,8 @@ WatchedFiles::
309360
{"fileName":"/user/username/projects/myproject/file1.ts","pollingInterval":250}
310361
/user/username/projects/myproject/src/file2.ts:
311362
{"fileName":"/user/username/projects/myproject/src/file2.ts","pollingInterval":250}
312-
/a/lib/lib.d.ts:
313-
{"fileName":"/a/lib/lib.d.ts","pollingInterval":250}
363+
/a/lib/lib.es2016.full.d.ts:
364+
{"fileName":"/a/lib/lib.es2016.full.d.ts","pollingInterval":250}
314365
/user/username/projects/myproject/src/file3.ts:
315366
{"fileName":"/user/username/projects/myproject/src/file3.ts","pollingInterval":250}
316367

0 commit comments

Comments
 (0)