mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Properly detect explicitly-set targets (#51834)
This commit is contained in:
@@ -522,7 +522,7 @@ export const targetOptionDeclaration: CommandLineOptionOfCustomType = {
|
||||
showInSimplifiedHelpView: true,
|
||||
category: Diagnostics.Language_and_Environment,
|
||||
description: Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
|
||||
defaultValueDescription: ScriptTarget.ES3,
|
||||
defaultValueDescription: ScriptTarget.ES5,
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
|
||||
@@ -7515,10 +7515,10 @@ export function getSetExternalModuleIndicator(options: CompilerOptions): (file:
|
||||
|
||||
/** @internal */
|
||||
export function getEmitScriptTarget(compilerOptions: {module?: CompilerOptions["module"], target?: CompilerOptions["target"]}): ScriptTarget {
|
||||
return compilerOptions.target ||
|
||||
(compilerOptions.module === ModuleKind.Node16 && ScriptTarget.ES2022) ||
|
||||
return compilerOptions.target ??
|
||||
((compilerOptions.module === ModuleKind.Node16 && ScriptTarget.ES2022) ||
|
||||
(compilerOptions.module === ModuleKind.NodeNext && ScriptTarget.ESNext) ||
|
||||
ScriptTarget.ES5;
|
||||
ScriptTarget.ES5);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck1.ts(1,15): error TS2494: Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck1.ts (1 errors) ====
|
||||
for (var v of "") { }
|
||||
~~
|
||||
!!! error TS2494: Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher.
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck4.ts(2,17): error TS2494: Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck4.ts (1 errors) ====
|
||||
var union: string | string[];
|
||||
for (const v of union) { }
|
||||
~~~~~
|
||||
!!! error TS2494: Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher.
|
||||
@@ -0,0 +1,35 @@
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES3.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES3.ts(10,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES3.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES3.ts(19,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/propertyMemberDeclarations/memberAccessorDeclarations/accessorWithES3.ts (4 errors) ====
|
||||
// error to use accessors in ES3 mode
|
||||
|
||||
class C {
|
||||
get x() {
|
||||
~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
class D {
|
||||
set x(v) {
|
||||
~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
}
|
||||
}
|
||||
|
||||
var x = {
|
||||
get a() { return 1 }
|
||||
~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
}
|
||||
|
||||
var y = {
|
||||
set b(v) { }
|
||||
~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
tests/cases/compiler/accessorsNotAllowedInES3.ts(2,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/compiler/accessorsNotAllowedInES3.ts(4,15): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
|
||||
|
||||
==== tests/cases/compiler/accessorsNotAllowedInES3.ts (2 errors) ====
|
||||
class C {
|
||||
get x(): number { return 1; }
|
||||
~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
}
|
||||
var y = { get foo() { return 3; } };
|
||||
~~~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
error TS5048: Option 'useDefineForClassFields' cannot be specified when option 'target' is 'ES3'.
|
||||
|
||||
|
||||
!!! error TS5048: Option 'useDefineForClassFields' cannot be specified when option 'target' is 'ES3'.
|
||||
==== tests/cases/conformance/classes/propertyMemberDeclarations/definePropertyOutputES3.ts (0 errors) ====
|
||||
class A {
|
||||
a = 12
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
tests/cases/compiler/es3-oldStyleOctalLiteralInEnums.ts(2,7): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o1'.
|
||||
tests/cases/compiler/es3-oldStyleOctalLiteralInEnums.ts(3,7): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o2'.
|
||||
tests/cases/compiler/es3-oldStyleOctalLiteralInEnums.ts(2,7): error TS8018: Octal literals are not allowed in enums members initializer. Use the syntax '-0o1'.
|
||||
tests/cases/compiler/es3-oldStyleOctalLiteralInEnums.ts(3,7): error TS8018: Octal literals are not allowed in enums members initializer. Use the syntax '0o2'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/es3-oldStyleOctalLiteralInEnums.ts (2 errors) ====
|
||||
enum E {
|
||||
x = -01,
|
||||
~~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o1'.
|
||||
!!! error TS8018: Octal literals are not allowed in enums members initializer. Use the syntax '-0o1'.
|
||||
y = 02,
|
||||
~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o2'.
|
||||
!!! error TS8018: Octal literals are not allowed in enums members initializer. Use the syntax '0o2'.
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
tests/cases/compiler/es3-oldStyleOctalLiteralTypes.ts(1,8): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o10'.
|
||||
tests/cases/compiler/es3-oldStyleOctalLiteralTypes.ts(2,8): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o20'.
|
||||
tests/cases/compiler/es3-oldStyleOctalLiteralTypes.ts(1,8): error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o10'.
|
||||
tests/cases/compiler/es3-oldStyleOctalLiteralTypes.ts(2,8): error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '-0o20'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/es3-oldStyleOctalLiteralTypes.ts (2 errors) ====
|
||||
let x: 010;
|
||||
~~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o10'.
|
||||
!!! error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '0o10'.
|
||||
let y: -020;
|
||||
~~~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o20'.
|
||||
!!! error TS8017: Octal literal types must use ES2015 syntax. Use the syntax '-0o20'.
|
||||
|
||||
@@ -15,7 +15,7 @@ assert(Foo.CONSTANT === "Foo");
|
||||
|
||||
//// [es3defaultAliasQuoted_file0.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
exports.Foo = void 0;
|
||||
var Foo = /** @class */ (function () {
|
||||
function Foo() {
|
||||
@@ -28,9 +28,9 @@ function assert(value) {
|
||||
if (!value)
|
||||
throw new Error("Assertion failed!");
|
||||
}
|
||||
exports.default = assert;
|
||||
exports["default"] = assert;
|
||||
//// [es3defaultAliasQuoted_file1.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
var es3defaultAliasQuoted_file0_1 = require("./es3defaultAliasQuoted_file0");
|
||||
(0, es3defaultAliasQuoted_file0_1.default)(es3defaultAliasQuoted_file0_1.Foo.CONSTANT === "Foo");
|
||||
(0, es3defaultAliasQuoted_file0_1["default"])(es3defaultAliasQuoted_file0_1.Foo.CONSTANT === "Foo");
|
||||
|
||||
@@ -40,12 +40,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
exports.y = exports.x = void 0;
|
||||
var fs = __importStar(require("./fs"));
|
||||
fs;
|
||||
__exportStar(require("./fs"), exports);
|
||||
var fs_1 = require("./fs");
|
||||
Object.defineProperty(exports, "x", { enumerable: true, get: function () { return fs_1.x; } });
|
||||
__createBinding(exports, fs_1, "x");
|
||||
var fs_2 = require("./fs");
|
||||
Object.defineProperty(exports, "y", { enumerable: true, get: function () { return fs_2.x; } });
|
||||
__createBinding(exports, fs_2, "x", "y");
|
||||
|
||||
@@ -14,17 +14,17 @@ export default function f2() {
|
||||
//// [m1.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
function f1() {
|
||||
}
|
||||
exports.default = f1;
|
||||
exports["default"] = f1;
|
||||
});
|
||||
//// [m2.js]
|
||||
define(["require", "exports", "./m1"], function (require, exports, m1_1) {
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
function f2() {
|
||||
(0, m1_1.default)();
|
||||
(0, m1_1["default"])();
|
||||
}
|
||||
exports.default = f2;
|
||||
exports["default"] = f2;
|
||||
});
|
||||
|
||||
@@ -13,15 +13,15 @@ export default function f2() {
|
||||
|
||||
//// [m1.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
function f1() {
|
||||
}
|
||||
exports.default = f1;
|
||||
exports["default"] = f1;
|
||||
//// [m2.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
var m1_1 = require("./m1");
|
||||
function f2() {
|
||||
(0, m1_1.default)();
|
||||
(0, m1_1["default"])();
|
||||
}
|
||||
exports.default = f2;
|
||||
exports["default"] = f2;
|
||||
|
||||
@@ -15,15 +15,15 @@ const { __, _, ___ } = R;
|
||||
|
||||
//// [m1.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
var R;
|
||||
exports.default = R = {
|
||||
exports["default"] = R = {
|
||||
"__": 20,
|
||||
"_": 10,
|
||||
"___": 30
|
||||
};
|
||||
//// [m2.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
var m1_1 = require("./m1");
|
||||
var __ = m1_1.default.__, _ = m1_1.default._, ___ = m1_1.default.___;
|
||||
var __ = m1_1["default"].__, _ = m1_1["default"]._, ___ = m1_1["default"].___;
|
||||
|
||||
@@ -14,14 +14,14 @@ const { __esmodule, __proto__ } = R;
|
||||
|
||||
//// [m1.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
var R;
|
||||
exports.default = R = {
|
||||
exports["default"] = R = {
|
||||
"__esmodule": true,
|
||||
"__proto__": {}
|
||||
};
|
||||
//// [m2.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
var m1_1 = require("./m1");
|
||||
var __esmodule = m1_1.default.__esmodule, __proto__ = m1_1.default.__proto__;
|
||||
var __esmodule = m1_1["default"].__esmodule, __proto__ = m1_1["default"].__proto__;
|
||||
|
||||
@@ -15,15 +15,15 @@ const { ___, ___hello, _hi } = R;
|
||||
|
||||
//// [m1.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
var R;
|
||||
exports.default = R = {
|
||||
exports["default"] = R = {
|
||||
"___": 30,
|
||||
"___hello": 21,
|
||||
"_hi": 40,
|
||||
"_hi": 40
|
||||
};
|
||||
//// [m2.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
var m1_1 = require("./m1");
|
||||
var ___ = m1_1.default.___, ___hello = m1_1.default.___hello, _hi = m1_1.default._hi;
|
||||
var ___ = m1_1["default"].___, ___hello = m1_1["default"].___hello, _hi = m1_1["default"]._hi;
|
||||
|
||||
@@ -35,7 +35,7 @@ _hi();
|
||||
|
||||
//// [m1.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
exports.___hello = exports.__esmodule = exports.__proto = exports._hi = exports.___ = exports.__ = exports._ = void 0;
|
||||
function _() {
|
||||
console.log("_");
|
||||
@@ -67,7 +67,7 @@ function ___hello() {
|
||||
exports.___hello = ___hello;
|
||||
//// [m2.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
var m1_1 = require("./m1");
|
||||
(0, m1_1._)();
|
||||
(0, m1_1.__)();
|
||||
|
||||
@@ -67,7 +67,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
};
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
exports.l = exports.cl2 = exports.obj = exports.cl1 = exports.fn = void 0;
|
||||
function fn() {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
|
||||
@@ -66,7 +66,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
exports.l = exports.cl2 = exports.obj = exports.cl1 = exports.fn = void 0;
|
||||
function fn() {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
|
||||
@@ -74,7 +74,7 @@ System.register([], function (exports_1, context_1) {
|
||||
var req;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, context_1.import('./test')]; // ONE
|
||||
case 0: return [4 /*yield*/, context_1["import"]('./test')]; // ONE
|
||||
case 1:
|
||||
req = _a.sent() // ONE
|
||||
;
|
||||
@@ -95,7 +95,7 @@ System.register([], function (exports_1, context_1) {
|
||||
var req;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, context_1.import('./test')]; // TWO
|
||||
case 0: return [4 /*yield*/, context_1["import"]('./test')]; // TWO
|
||||
case 1:
|
||||
req = _a.sent() // TWO
|
||||
;
|
||||
@@ -112,7 +112,7 @@ System.register([], function (exports_1, context_1) {
|
||||
var req;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, context_1.import('./test')]; // THREE
|
||||
case 0: return [4 /*yield*/, context_1["import"]('./test')]; // THREE
|
||||
case 1:
|
||||
req = _a.sent() // THREE
|
||||
;
|
||||
@@ -129,7 +129,7 @@ System.register([], function (exports_1, context_1) {
|
||||
var req;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, context_1.import('./test')]; // FOUR
|
||||
case 0: return [4 /*yield*/, context_1["import"]('./test')]; // FOUR
|
||||
case 1:
|
||||
req = _a.sent() // FOUR
|
||||
;
|
||||
@@ -146,7 +146,7 @@ System.register([], function (exports_1, context_1) {
|
||||
var req;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, context_1.import('./test')]; // FIVE
|
||||
case 0: return [4 /*yield*/, context_1["import"]('./test')]; // FIVE
|
||||
case 1:
|
||||
req = _a.sent() // FIVE
|
||||
;
|
||||
|
||||
@@ -76,7 +76,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
})(function (require, exports) {
|
||||
"use strict";
|
||||
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
exports.l = exports.cl2 = exports.obj = exports.cl1 = exports.fn = void 0;
|
||||
function fn() {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
tests/cases/compiler/isLiteral2.ts(1,17): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o2343'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/isLiteral2.ts (1 errors) ====
|
||||
var x: number = 02343
|
||||
~~~~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o2343'.
|
||||
@@ -0,0 +1,20 @@
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrorsES3.ts(1,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrorsES3.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrorsES3.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/expressions/objectLiterals/objectLiteralErrorsES3.ts(3,40): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/objectLiterals/objectLiteralErrorsES3.ts (4 errors) ====
|
||||
var e1 = { get a() { return 4; } };
|
||||
~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
var e2 = { set a(n) { } };
|
||||
~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
var e3 = { get a() { return ''; }, set a(n) { } };
|
||||
~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
|
||||
|
||||
@@ -1,153 +0,0 @@
|
||||
tests/cases/conformance/types/members/objectTypeWithStringNamedNumericProperty.ts(33,13): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'.
|
||||
tests/cases/conformance/types/members/objectTypeWithStringNamedNumericProperty.ts(34,13): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o1'.
|
||||
tests/cases/conformance/types/members/objectTypeWithStringNamedNumericProperty.ts(64,13): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'.
|
||||
tests/cases/conformance/types/members/objectTypeWithStringNamedNumericProperty.ts(65,13): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o1'.
|
||||
tests/cases/conformance/types/members/objectTypeWithStringNamedNumericProperty.ts(94,13): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'.
|
||||
tests/cases/conformance/types/members/objectTypeWithStringNamedNumericProperty.ts(95,13): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o1'.
|
||||
tests/cases/conformance/types/members/objectTypeWithStringNamedNumericProperty.ts(124,13): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'.
|
||||
tests/cases/conformance/types/members/objectTypeWithStringNamedNumericProperty.ts(125,13): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o1'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/members/objectTypeWithStringNamedNumericProperty.ts (8 errors) ====
|
||||
// string named numeric properties are legal and distinct when indexed by string values
|
||||
// indexed numerically the value is converted to a number
|
||||
// no errors expected below
|
||||
|
||||
class C {
|
||||
"0.1": void;
|
||||
".1": Object;
|
||||
"1": number;
|
||||
"1.": string;
|
||||
"1..": boolean;
|
||||
"1.0": Date;
|
||||
"-1.0": RegExp;
|
||||
"-1": Date;
|
||||
}
|
||||
|
||||
var c: C;
|
||||
var r1 = c['0.1'];
|
||||
var r2 = c['.1'];
|
||||
var r3 = c['1'];
|
||||
var r3 = c[1];
|
||||
var r4 = c['1.'];
|
||||
var r3 = c[1.]; // same as indexing by 1 when done numerically
|
||||
var r5 = c['1..'];
|
||||
var r6 = c['1.0'];
|
||||
var r3 = c[1.0]; // same as indexing by 1 when done numerically
|
||||
// BUG 823822
|
||||
var r7 = i[-1];
|
||||
var r7 = i[-1.0];
|
||||
var r8 = i["-1.0"];
|
||||
var r9 = i["-1"];
|
||||
var r10 = i[0x1]
|
||||
var r11 = i[-0x1]
|
||||
var r12 = i[01]
|
||||
~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'.
|
||||
var r13 = i[-01]
|
||||
~~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o1'.
|
||||
|
||||
interface I {
|
||||
"0.1": void;
|
||||
".1": Object;
|
||||
"1": number;
|
||||
"1.": string;
|
||||
"1..": boolean;
|
||||
"1.0": Date;
|
||||
"-1.0": RegExp;
|
||||
"-1": Date;
|
||||
}
|
||||
|
||||
var i: I;
|
||||
var r1 = i['0.1'];
|
||||
var r2 = i['.1'];
|
||||
var r3 = i['1'];
|
||||
var r3 = c[1];
|
||||
var r4 = i['1.'];
|
||||
var r3 = c[1.]; // same as indexing by 1 when done numerically
|
||||
var r5 = i['1..'];
|
||||
var r6 = i['1.0'];
|
||||
var r3 = c[1.0]; // same as indexing by 1 when done numerically
|
||||
// BUG 823822
|
||||
var r7 = i[-1];
|
||||
var r7 = i[-1.0];
|
||||
var r8 = i["-1.0"];
|
||||
var r9 = i["-1"];
|
||||
var r10 = i[0x1]
|
||||
var r11 = i[-0x1]
|
||||
var r12 = i[01]
|
||||
~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'.
|
||||
var r13 = i[-01]
|
||||
~~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o1'.
|
||||
|
||||
var a: {
|
||||
"0.1": void;
|
||||
".1": Object;
|
||||
"1": number;
|
||||
"1.": string;
|
||||
"1..": boolean;
|
||||
"1.0": Date;
|
||||
"-1.0": RegExp;
|
||||
"-1": Date;
|
||||
}
|
||||
|
||||
var r1 = a['0.1'];
|
||||
var r2 = a['.1'];
|
||||
var r3 = a['1'];
|
||||
var r3 = c[1];
|
||||
var r4 = a['1.'];
|
||||
var r3 = c[1.]; // same as indexing by 1 when done numerically
|
||||
var r5 = a['1..'];
|
||||
var r6 = a['1.0'];
|
||||
var r3 = c[1.0]; // same as indexing by 1 when done numerically
|
||||
// BUG 823822
|
||||
var r7 = i[-1];
|
||||
var r7 = i[-1.0];
|
||||
var r8 = i["-1.0"];
|
||||
var r9 = i["-1"];
|
||||
var r10 = i[0x1]
|
||||
var r11 = i[-0x1]
|
||||
var r12 = i[01]
|
||||
~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'.
|
||||
var r13 = i[-01]
|
||||
~~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o1'.
|
||||
|
||||
var b = {
|
||||
"0.1": <void>null,
|
||||
".1": new Object(),
|
||||
"1": 1,
|
||||
"1.": "",
|
||||
"1..": true,
|
||||
"1.0": new Date(),
|
||||
"-1.0": /123/,
|
||||
"-1": Date
|
||||
};
|
||||
|
||||
var r1 = b['0.1'];
|
||||
var r2 = b['.1'];
|
||||
var r3 = b['1'];
|
||||
var r3 = c[1];
|
||||
var r4 = b['1.'];
|
||||
var r3 = c[1.]; // same as indexing by 1 when done numerically
|
||||
var r5 = b['1..'];
|
||||
var r6 = b['1.0'];
|
||||
var r3 = c[1.0]; // same as indexing by 1 when done numerically
|
||||
// BUG 823822
|
||||
var r7 = i[-1];
|
||||
var r7 = i[-1.0];
|
||||
var r8 = i["-1.0"];
|
||||
var r9 = i["-1"];
|
||||
var r10 = i[0x1]
|
||||
var r11 = i[-0x1]
|
||||
var r12 = i[01]
|
||||
~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'.
|
||||
var r13 = i[-01]
|
||||
~~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o1'.
|
||||
|
||||
@@ -2,10 +2,10 @@ tests/cases/conformance/classes/members/privateNames/privateNameES5Ban.ts(3,5):
|
||||
tests/cases/conformance/classes/members/privateNames/privateNameES5Ban.ts(4,5): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
|
||||
tests/cases/conformance/classes/members/privateNames/privateNameES5Ban.ts(5,12): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
|
||||
tests/cases/conformance/classes/members/privateNames/privateNameES5Ban.ts(6,12): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
|
||||
tests/cases/conformance/classes/members/privateNames/privateNameES5Ban.ts(7,9): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
|
||||
tests/cases/conformance/classes/members/privateNames/privateNameES5Ban.ts(8,9): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
|
||||
tests/cases/conformance/classes/members/privateNames/privateNameES5Ban.ts(9,16): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
|
||||
tests/cases/conformance/classes/members/privateNames/privateNameES5Ban.ts(10,16): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
|
||||
tests/cases/conformance/classes/members/privateNames/privateNameES5Ban.ts(7,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/classes/members/privateNames/privateNameES5Ban.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/classes/members/privateNames/privateNameES5Ban.ts(9,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/classes/members/privateNames/privateNameES5Ban.ts(10,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/members/privateNames/privateNameES5Ban.ts (8 errors) ====
|
||||
@@ -25,16 +25,16 @@ tests/cases/conformance/classes/members/privateNames/privateNameES5Ban.ts(10,16)
|
||||
!!! error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
|
||||
get #acc() { return ""; }
|
||||
~~~~
|
||||
!!! error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
set #acc(x: string) {}
|
||||
~~~~
|
||||
!!! error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
static get #sAcc() { return 0; }
|
||||
~~~~~
|
||||
!!! error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
static set #sAcc(x: number) {}
|
||||
~~~~~
|
||||
!!! error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
|
||||
!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
tests/cases/conformance/expressions/propertyAccess/propertyAccessNumericLiterals.ts(6,1): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o0'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/propertyAccess/propertyAccessNumericLiterals.ts (1 errors) ====
|
||||
0xffffffff.toString();
|
||||
0o01234.toString();
|
||||
0b01101101.toString();
|
||||
1234..toString();
|
||||
1e0.toString();
|
||||
000.toString();
|
||||
~~~
|
||||
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o0'.
|
||||
@@ -13,8 +13,8 @@ var a6 = [, , ];
|
||||
|
||||
//// [trailingCommasES3.js]
|
||||
var o1 = { a: 1, b: 2 };
|
||||
var o2 = { a: 1, b: 2, };
|
||||
var o3 = { a: 1, };
|
||||
var o2 = { a: 1, b: 2 };
|
||||
var o3 = { a: 1 };
|
||||
var o4 = {};
|
||||
var a1 = [1, 2];
|
||||
var a2 = [1, 2,];
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
//# sourceMappingURL=file.js.map
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
//# sourceMappingURL=file.js.map
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
//# sourceMappingURL=file.js.map
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
//# sourceMappingURL=file.js.map
|
||||
@@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
exports.alias = void 0;
|
||||
var a;
|
||||
exports.alias = a;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
exports.alias = void 0;
|
||||
var a;
|
||||
exports.alias = a;
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
//# sourceMappingURL=file.js.map
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
//# sourceMappingURL=file.js.map
|
||||
@@ -1,6 +1,6 @@
|
||||
define(["require", "exports", "SomeOtherName"], function (require, exports, SomeName_1) {
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
use(SomeName_1.foo);
|
||||
});
|
||||
//# sourceMappingURL=file.js.map
|
||||
@@ -8,7 +8,7 @@
|
||||
}
|
||||
})(function (require, exports) {
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
var SomeName_1 = require("SomeOtherName");
|
||||
use(SomeName_1.foo);
|
||||
});
|
||||
|
||||
+13
-2
@@ -342,7 +342,7 @@ export declare const m: typeof mod;
|
||||
|
||||
//// [/src/tests/index.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.__esModule = true;
|
||||
exports.m = void 0;
|
||||
var c = require("../core/index");
|
||||
var logic = require("../logic/index");
|
||||
@@ -470,7 +470,18 @@ Output::
|
||||
exitCode:: ExitStatus.Success
|
||||
|
||||
|
||||
//// [/src/tests/index.js] file written with same contents
|
||||
//// [/src/tests/index.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.m = void 0;
|
||||
var c = require("../core/index");
|
||||
var logic = require("../logic/index");
|
||||
c.leftPad("", 10);
|
||||
logic.getSecondsInDay();
|
||||
var mod = require("../core/anotherModule");
|
||||
exports.m = mod;
|
||||
|
||||
|
||||
//// [/src/tests/tsconfig.tsbuildinfo]
|
||||
{"program":{"fileNames":["../../lib/lib.d.ts","../core/index.d.ts","../core/anothermodule.d.ts","../logic/index.d.ts","./index.ts"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},"1874987148-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\n","-8396256275-export declare const World = \"hello\";\r\n","-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n",{"version":"12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n","signature":"-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n"}],"options":{"composite":true,"declaration":true,"skipDefaultLibCheck":true},"fileIdsList":[[3],[2,3,4]],"referencedMap":[[4,1],[5,2]],"exportedModulesMap":[[4,1],[5,1]],"semanticDiagnosticsPerFile":[1,3,2,4,5],"latestChangedDtsFile":"./index.d.ts"},"version":"FakeTSVersion"}
|
||||
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ default: false
|
||||
--target, -t
|
||||
Set the JavaScript language version for emitted JavaScript and include compatible library declarations.
|
||||
one of: es3, es5, es6/es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext
|
||||
default: es3
|
||||
default: es5
|
||||
|
||||
--module, -m
|
||||
Specify what module code is generated.
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ default: false
|
||||
[94m--target, -t[39m
|
||||
Set the JavaScript language version for emitted JavaScript and include compatible library declarations.
|
||||
one of: es3, es5, es6/es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext
|
||||
default: es3
|
||||
default: es5
|
||||
|
||||
[94m--module, -m[39m
|
||||
Specify what module code is generated.
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ default: false
|
||||
[94m--target, -t[39m
|
||||
Set the JavaScript language version for emitted JavaScript and include compatible library declarations.
|
||||
one of: es3, es5, es6/es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, esnext
|
||||
default: es3
|
||||
default: es5
|
||||
|
||||
[94m--module, -m[39m
|
||||
Specify what module code is generated.
|
||||
|
||||
Reference in New Issue
Block a user