Skip to content

Commit a3dbe7d

Browse files
Update default target from ES3 to ES5 (#51731)
* Change the default emit target to ES5 * Add baseline update * Remove tests with a hardcoded sourcemap in it * Update hardcoded tests * Merge with main * Restore tests
1 parent 3716ffe commit a3dbe7d

File tree

2,983 files changed

+10122
-12098
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,983 files changed

+10122
-12098
lines changed

src/compiler/utilities.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7514,11 +7514,11 @@ export function getSetExternalModuleIndicator(options: CompilerOptions): (file:
75147514
}
75157515

75167516
/** @internal */
7517-
export function getEmitScriptTarget(compilerOptions: {module?: CompilerOptions["module"], target?: CompilerOptions["target"]}) {
7517+
export function getEmitScriptTarget(compilerOptions: {module?: CompilerOptions["module"], target?: CompilerOptions["target"]}): ScriptTarget {
75187518
return compilerOptions.target ||
75197519
(compilerOptions.module === ModuleKind.Node16 && ScriptTarget.ES2022) ||
75207520
(compilerOptions.module === ModuleKind.NodeNext && ScriptTarget.ESNext) ||
7521-
ScriptTarget.ES3;
7521+
ScriptTarget.ES5;
75227522
}
75237523

75247524
/** @internal */

tests/baselines/reference/APILibCheck.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ import tsserverlibraryInternal = require("tsserverlibrary-internal");
3333

3434
//// [index.js]
3535
"use strict";
36-
exports.__esModule = true;
36+
Object.defineProperty(exports, "__esModule", { value: true });

tests/baselines/reference/APISample_Watch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ watchMain();
9090
* at: https://github.com/Microsoft/TypeScript-wiki/blob/master/Using-the-Compiler-API.md#writing-an-incremental-program-watcher
9191
* Please log a "breaking change" issue for any API breaking change affecting this issue
9292
*/
93-
exports.__esModule = true;
93+
Object.defineProperty(exports, "__esModule", { value: true });
9494
var ts = require("typescript");
9595
var formatHost = {
9696
getCanonicalFileName: function (path) { return path; },
9797
getCurrentDirectory: ts.sys.getCurrentDirectory,
98-
getNewLine: function () { return ts.sys.newLine; }
98+
getNewLine: function () { return ts.sys.newLine; },
9999
};
100100
function watchMain() {
101101
var configPath = ts.findConfigFile(/*searchPath*/ "./", ts.sys.fileExists, "tsconfig.json");

tests/baselines/reference/APISample_WatchWithDefaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ watchMain();
6262
* Note: This test is a public API sample. This uses default sys interface without having to pass anything
6363
* Please log a "breaking change" issue for any API breaking change affecting this issue
6464
*/
65-
exports.__esModule = true;
65+
Object.defineProperty(exports, "__esModule", { value: true });
6666
var ts = require("typescript");
6767
function watchMain() {
6868
var configPath = ts.findConfigFile(/*searchPath*/ "./", ts.sys.fileExists, "tsconfig.json");

tests/baselines/reference/APISample_WatchWithOwnWatchHost.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ watchMain();
6969
* Note: This test is a public API sample. This sample verifies creating abstract builder to watch list of root files
7070
* Please log a "breaking change" issue for any API breaking change affecting this issue
7171
*/
72-
exports.__esModule = true;
72+
Object.defineProperty(exports, "__esModule", { value: true });
7373
var ts = require("typescript");
7474
function watchMain() {
7575
// get list of files and compiler options somehow

tests/baselines/reference/APISample_compile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ compile(process.argv.slice(2), {
5353
* at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler
5454
* Please log a "breaking change" issue for any API breaking change affecting this issue
5555
*/
56-
exports.__esModule = true;
56+
Object.defineProperty(exports, "__esModule", { value: true });
5757
exports.compile = void 0;
5858
var ts = require("typescript");
5959
function compile(fileNames, options) {

tests/baselines/reference/APISample_jsdoc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ function getSomeOtherTags(node: ts.Node) {
129129
* https://github.com/vega/ts-json-schema-generator
130130
* Please log a "breaking change" issue for any API breaking change affecting this issue
131131
*/
132-
exports.__esModule = true;
132+
Object.defineProperty(exports, "__esModule", { value: true });
133133
var ts = require("typescript");
134134
// excerpted from https://github.com/YousefED/typescript-json-schema
135135
// (converted from a method and modified; for example, `this: any` to compensate, among other changes)

tests/baselines/reference/APISample_linter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fileNames.forEach(fileName => {
7979
* at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter
8080
* Please log a "breaking change" issue for any API breaking change affecting this issue
8181
*/
82-
exports.__esModule = true;
82+
Object.defineProperty(exports, "__esModule", { value: true });
8383
exports.delint = void 0;
8484
var ts = require("typescript");
8585
function delint(sourceFile) {

tests/baselines/reference/APISample_parseConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function createProgram(rootFiles: string[], compilerOptionsJson: string):
5151
* at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler
5252
* Please log a "breaking change" issue for any API breaking change affecting this issue
5353
*/
54-
exports.__esModule = true;
54+
Object.defineProperty(exports, "__esModule", { value: true });
5555
exports.createProgram = void 0;
5656
var ts = require("typescript");
5757
function printError(error) {

tests/baselines/reference/APISample_transform.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ console.log(JSON.stringify(result));
3131
* at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-simple-transform-function
3232
* Please log a "breaking change" issue for any API breaking change affecting this issue
3333
*/
34-
exports.__esModule = true;
34+
Object.defineProperty(exports, "__esModule", { value: true });
3535
var ts = require("typescript");
3636
var source = "let x: string = 'string'";
3737
var result = ts.transpile(source, { module: ts.ModuleKind.CommonJS });

tests/baselines/reference/APISample_watcher.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS });
126126
* at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#incremental-build-support-using-the-language-services
127127
* Please log a "breaking change" issue for any API breaking change affecting this issue
128128
*/
129-
exports.__esModule = true;
129+
Object.defineProperty(exports, "__esModule", { value: true });
130130
var ts = require("typescript");
131131
function watch(rootFileNames, options) {
132132
var files = {};
@@ -148,7 +148,7 @@ function watch(rootFileNames, options) {
148148
getCompilationSettings: function () { return options; },
149149
getDefaultLibFileName: function (options) { return ts.getDefaultLibFilePath(options); },
150150
fileExists: function (fileName) { return fs.existsSync(fileName); },
151-
readFile: function (fileName) { return fs.readFileSync(fileName); }
151+
readFile: function (fileName) { return fs.readFileSync(fileName); },
152152
};
153153
// Create the language service files
154154
var services = ts.createLanguageService(servicesHost, ts.createDocumentRegistry());

tests/baselines/reference/DeclarationErrorsNoEmitOnError.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export interface I {
66

77
//// [DeclarationErrorsNoEmitOnError.js]
88
"use strict";
9-
exports.__esModule = true;
9+
Object.defineProperty(exports, "__esModule", { value: true });
1010

1111

1212
//// [DeclarationErrorsNoEmitOnError.d.ts]

tests/baselines/reference/ES3For-ofTypeCheck1.errors.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/baselines/reference/ES3For-ofTypeCheck4.errors.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/baselines/reference/ES5For-of33.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/baselines/reference/ES5For-of33.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/baselines/reference/ES5For-of33.sourcemap.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ sourceFile:ES5For-of33.ts
119119
>>>catch (e_1_1) { e_1 = { error: e_1_1 }; }
120120
>>>finally {
121121
>>> try {
122-
>>> if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
122+
>>> if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
123123
>>> }
124124
>>> finally { if (e_1) throw e_1.error; }
125125
>>>}

tests/baselines/reference/ES5For-of34.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/baselines/reference/ES5For-of34.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/baselines/reference/ES5For-of34.sourcemap.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ sourceFile:ES5For-of34.ts
178178
>>>catch (e_1_1) { e_1 = { error: e_1_1 }; }
179179
>>>finally {
180180
>>> try {
181-
>>> if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
181+
>>> if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
182182
>>> }
183183
>>> finally { if (e_1) throw e_1.error; }
184184
>>>}

tests/baselines/reference/ES5For-of35.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)