Skip to content

Update default target from ES3 to ES5 #51731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7514,11 +7514,11 @@ export function getSetExternalModuleIndicator(options: CompilerOptions): (file:
}

/** @internal */
export function getEmitScriptTarget(compilerOptions: {module?: CompilerOptions["module"], target?: CompilerOptions["target"]}) {
export function getEmitScriptTarget(compilerOptions: {module?: CompilerOptions["module"], target?: CompilerOptions["target"]}): ScriptTarget {
return compilerOptions.target ||
(compilerOptions.module === ModuleKind.Node16 && ScriptTarget.ES2022) ||
(compilerOptions.module === ModuleKind.NodeNext && ScriptTarget.ESNext) ||
ScriptTarget.ES3;
ScriptTarget.ES5;
}

/** @internal */
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/APILibCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ import tsserverlibraryInternal = require("tsserverlibrary-internal");

//// [index.js]
"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
4 changes: 2 additions & 2 deletions tests/baselines/reference/APISample_Watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ watchMain();
* at: https://github.com/Microsoft/TypeScript-wiki/blob/master/Using-the-Compiler-API.md#writing-an-incremental-program-watcher
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
var ts = require("typescript");
var formatHost = {
getCanonicalFileName: function (path) { return path; },
getCurrentDirectory: ts.sys.getCurrentDirectory,
getNewLine: function () { return ts.sys.newLine; }
getNewLine: function () { return ts.sys.newLine; },
};
function watchMain() {
var configPath = ts.findConfigFile(/*searchPath*/ "./", ts.sys.fileExists, "tsconfig.json");
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/APISample_WatchWithDefaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ watchMain();
* Note: This test is a public API sample. This uses default sys interface without having to pass anything
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
var ts = require("typescript");
function watchMain() {
var configPath = ts.findConfigFile(/*searchPath*/ "./", ts.sys.fileExists, "tsconfig.json");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ watchMain();
* Note: This test is a public API sample. This sample verifies creating abstract builder to watch list of root files
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
var ts = require("typescript");
function watchMain() {
// get list of files and compiler options somehow
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/APISample_compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ compile(process.argv.slice(2), {
* at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.compile = void 0;
var ts = require("typescript");
function compile(fileNames, options) {
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/APISample_jsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function getSomeOtherTags(node: ts.Node) {
* https://github.com/vega/ts-json-schema-generator
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
var ts = require("typescript");
// excerpted from https://github.com/YousefED/typescript-json-schema
// (converted from a method and modified; for example, `this: any` to compensate, among other changes)
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/APISample_linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ fileNames.forEach(fileName => {
* at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.delint = void 0;
var ts = require("typescript");
function delint(sourceFile) {
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/APISample_parseConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function createProgram(rootFiles: string[], compilerOptionsJson: string):
* at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createProgram = void 0;
var ts = require("typescript");
function printError(error) {
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/APISample_transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ console.log(JSON.stringify(result));
* at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-simple-transform-function
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
var ts = require("typescript");
var source = "let x: string = 'string'";
var result = ts.transpile(source, { module: ts.ModuleKind.CommonJS });
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/APISample_watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS });
* at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#incremental-build-support-using-the-language-services
* Please log a "breaking change" issue for any API breaking change affecting this issue
*/
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });
var ts = require("typescript");
function watch(rootFileNames, options) {
var files = {};
Expand All @@ -148,7 +148,7 @@ function watch(rootFileNames, options) {
getCompilationSettings: function () { return options; },
getDefaultLibFileName: function (options) { return ts.getDefaultLibFilePath(options); },
fileExists: function (fileName) { return fs.existsSync(fileName); },
readFile: function (fileName) { return fs.readFileSync(fileName); }
readFile: function (fileName) { return fs.readFileSync(fileName); },
};
// Create the language service files
var services = ts.createLanguageService(servicesHost, ts.createDocumentRegistry());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface I {

//// [DeclarationErrorsNoEmitOnError.js]
"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", { value: true });


//// [DeclarationErrorsNoEmitOnError.d.ts]
Expand Down
7 changes: 0 additions & 7 deletions tests/baselines/reference/ES3For-ofTypeCheck1.errors.txt

This file was deleted.

8 changes: 0 additions & 8 deletions tests/baselines/reference/ES3For-ofTypeCheck4.errors.txt

This file was deleted.

2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5For-of33.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5For-of33.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5For-of33.sourcemap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ sourceFile:ES5For-of33.ts
>>>catch (e_1_1) { e_1 = { error: e_1_1 }; }
>>>finally {
>>> try {
>>> if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
>>> if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
>>> }
>>> finally { if (e_1) throw e_1.error; }
>>>}
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5For-of34.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5For-of34.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5For-of34.sourcemap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ sourceFile:ES5For-of34.ts
>>>catch (e_1_1) { e_1 = { error: e_1_1 }; }
>>>finally {
>>> try {
>>> if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
>>> if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
>>> }
>>> finally { if (e_1) throw e_1.error; }
>>>}
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/ES5For-of35.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading