Allow to define valid static fields with names conflicting with builtin properties (#54198)

This commit is contained in:
Mateusz Burzyński 2023-05-23 01:44:24 +02:00 committed by GitHub
parent 0d262616f3
commit 1561701b9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 1845 additions and 183 deletions

View File

@ -38334,6 +38334,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
case "length":
case "caller":
case "arguments":
if (compilerOptions.useDefineForClassFields) {
break;
}
// fall through
case "prototype":
const message = Diagnostics.Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1;
const className = getNameOfSymbolAsWritten(getSymbolOfDeclaration(node));

View File

@ -44,14 +44,14 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon
==== tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts (41 errors) ====
// name
class StaticName {
static name: number; // error
static name: number; // error without useDefineForClassFields
~~~~
!!! error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function 'StaticName'.
name: string; // ok
}
class StaticNameFn {
static name() {} // error
static name() {} // error without useDefineForClassFields
~~~~
!!! error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function 'StaticNameFn'.
name() {} // ok
@ -59,14 +59,14 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon
// length
class StaticLength {
static length: number; // error
static length: number; // error without useDefineForClassFields
~~~~~~
!!! error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function 'StaticLength'.
length: string; // ok
}
class StaticLengthFn {
static length() {} // error
static length() {} // error without useDefineForClassFields
~~~~~~
!!! error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function 'StaticLengthFn'.
length() {} // ok
@ -74,14 +74,14 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon
// prototype
class StaticPrototype {
static prototype: number; // error
static prototype: number; // always an error
~~~~~~~~~
!!! error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototype'.
prototype: string; // ok
}
class StaticPrototypeFn {
static prototype() {} // error
static prototype() {} // always an error
~~~~~~~~~
!!! error TS2300: Duplicate identifier 'prototype'.
~~~~~~~~~
@ -91,14 +91,14 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon
// caller
class StaticCaller {
static caller: number; // error
static caller: number; // error without useDefineForClassFields
~~~~~~
!!! error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function 'StaticCaller'.
caller: string; // ok
}
class StaticCallerFn {
static caller() {} // error
static caller() {} // error without useDefineForClassFields
~~~~~~
!!! error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function 'StaticCallerFn'.
caller() {} // ok
@ -106,14 +106,14 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon
// arguments
class StaticArguments {
static arguments: number; // error
static arguments: number; // error without useDefineForClassFields
~~~~~~~~~
!!! error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArguments'.
arguments: string; // ok
}
class StaticArgumentsFn {
static arguments() {} // error
static arguments() {} // error without useDefineForClassFields
~~~~~~~~~
!!! error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArgumentsFn'.
arguments() {} // ok
@ -125,14 +125,14 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon
// name
var StaticName_Anonymous = class {
static name: number; // error
static name: number; // error without useDefineForClassFields
~~~~
!!! error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function 'StaticName_Anonymous'.
name: string; // ok
}
var StaticNameFn_Anonymous = class {
static name() {} // error
static name() {} // error without useDefineForClassFields
~~~~
!!! error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function 'StaticNameFn_Anonymous'.
name() {} // ok
@ -140,14 +140,14 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon
// length
var StaticLength_Anonymous = class {
static length: number; // error
static length: number; // error without useDefineForClassFields
~~~~~~
!!! error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function 'StaticLength_Anonymous'.
length: string; // ok
}
var StaticLengthFn_Anonymous = class {
static length() {} // error
static length() {} // error without useDefineForClassFields
~~~~~~
!!! error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function 'StaticLengthFn_Anonymous'.
length() {} // ok
@ -155,14 +155,14 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon
// prototype
var StaticPrototype_Anonymous = class {
static prototype: number; // error
static prototype: number; // always an error
~~~~~~~~~
!!! error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototype_Anonymous'.
prototype: string; // ok
}
var StaticPrototypeFn_Anonymous = class {
static prototype() {} // error
static prototype() {} // always an error
~~~~~~~~~
!!! error TS2300: Duplicate identifier 'prototype'.
~~~~~~~~~
@ -172,14 +172,14 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon
// caller
var StaticCaller_Anonymous = class {
static caller: number; // error
static caller: number; // error without useDefineForClassFields
~~~~~~
!!! error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function 'StaticCaller_Anonymous'.
caller: string; // ok
}
var StaticCallerFn_Anonymous = class {
static caller() {} // error
static caller() {} // error without useDefineForClassFields
~~~~~~
!!! error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function 'StaticCallerFn_Anonymous'.
caller() {} // ok
@ -187,14 +187,14 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon
// arguments
var StaticArguments_Anonymous = class {
static arguments: number; // error
static arguments: number; // error without useDefineForClassFields
~~~~~~~~~
!!! error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArguments_Anonymous'.
arguments: string; // ok
}
var StaticArgumentsFn_Anonymous = class {
static arguments() {} // error
static arguments() {} // error without useDefineForClassFields
~~~~~~~~~
!!! error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArgumentsFn_Anonymous'.
arguments() {} // ok
@ -206,7 +206,7 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon
// name
module TestOnDefaultExportedClass_1 {
class StaticName {
static name: number; // error
static name: number; // error without useDefineForClassFields
~~~~
!!! error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function 'StaticName'.
name: string; // ok
@ -215,7 +215,7 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon
module TestOnDefaultExportedClass_2 {
class StaticNameFn {
static name() {} // error
static name() {} // error without useDefineForClassFields
~~~~
!!! error TS2699: Static property 'name' conflicts with built-in property 'Function.name' of constructor function 'StaticNameFn'.
name() {} // ok
@ -227,7 +227,7 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon
export default class StaticLength {
~~~~~~~
!!! error TS1319: A default export can only be used in an ECMAScript-style module.
static length: number; // error
static length: number; // error without useDefineForClassFields
~~~~~~
!!! error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function 'StaticLength'.
length: string; // ok
@ -238,7 +238,7 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon
export default class StaticLengthFn {
~~~~~~~
!!! error TS1319: A default export can only be used in an ECMAScript-style module.
static length() {} // error
static length() {} // error without useDefineForClassFields
~~~~~~
!!! error TS2699: Static property 'length' conflicts with built-in property 'Function.length' of constructor function 'StaticLengthFn'.
length() {} // ok
@ -246,11 +246,11 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon
}
// prototype
module TestOnDefaultExportedClass_5 {
module TestOnDefaultExportedClass_5 {
export default class StaticPrototype {
~~~~~~~
!!! error TS1319: A default export can only be used in an ECMAScript-style module.
static prototype: number; // error
static prototype: number; // always an error
~~~~~~~~~
!!! error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototype'.
prototype: string; // ok
@ -261,7 +261,7 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon
export default class StaticPrototypeFn {
~~~~~~~
!!! error TS1319: A default export can only be used in an ECMAScript-style module.
static prototype() {} // error
static prototype() {} // always an error
~~~~~~~~~
!!! error TS2300: Duplicate identifier 'prototype'.
~~~~~~~~~
@ -275,7 +275,7 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon
export default class StaticCaller {
~~~~~~~
!!! error TS1319: A default export can only be used in an ECMAScript-style module.
static caller: number; // error
static caller: number; // error without useDefineForClassFields
~~~~~~
!!! error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function 'StaticCaller'.
caller: string; // ok
@ -286,7 +286,7 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon
export default class StaticCallerFn {
~~~~~~~
!!! error TS1319: A default export can only be used in an ECMAScript-style module.
static caller() {} // error
static caller() {} // error without useDefineForClassFields
~~~~~~
!!! error TS2699: Static property 'caller' conflicts with built-in property 'Function.caller' of constructor function 'StaticCallerFn'.
caller() {} // ok
@ -298,7 +298,7 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon
export default class StaticArguments {
~~~~~~~
!!! error TS1319: A default export can only be used in an ECMAScript-style module.
static arguments: number; // error
static arguments: number; // error without useDefineForClassFields
~~~~~~~~~
!!! error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArguments'.
arguments: string; // ok
@ -309,9 +309,10 @@ tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameCon
export default class StaticArgumentsFn {
~~~~~~~
!!! error TS1319: A default export can only be used in an ECMAScript-style module.
static arguments() {} // error
static arguments() {} // error without useDefineForClassFields
~~~~~~~~~
!!! error TS2699: Static property 'arguments' conflicts with built-in property 'Function.arguments' of constructor function 'StaticArgumentsFn'.
arguments() {} // ok
}
}
}

View File

@ -1,56 +1,56 @@
//// [staticPropertyNameConflicts.ts]
// name
class StaticName {
static name: number; // error
static name: number; // error without useDefineForClassFields
name: string; // ok
}
class StaticNameFn {
static name() {} // error
static name() {} // error without useDefineForClassFields
name() {} // ok
}
// length
class StaticLength {
static length: number; // error
static length: number; // error without useDefineForClassFields
length: string; // ok
}
class StaticLengthFn {
static length() {} // error
static length() {} // error without useDefineForClassFields
length() {} // ok
}
// prototype
class StaticPrototype {
static prototype: number; // error
static prototype: number; // always an error
prototype: string; // ok
}
class StaticPrototypeFn {
static prototype() {} // error
static prototype() {} // always an error
prototype() {} // ok
}
// caller
class StaticCaller {
static caller: number; // error
static caller: number; // error without useDefineForClassFields
caller: string; // ok
}
class StaticCallerFn {
static caller() {} // error
static caller() {} // error without useDefineForClassFields
caller() {} // ok
}
// arguments
class StaticArguments {
static arguments: number; // error
static arguments: number; // error without useDefineForClassFields
arguments: string; // ok
}
class StaticArgumentsFn {
static arguments() {} // error
static arguments() {} // error without useDefineForClassFields
arguments() {} // ok
}
@ -60,56 +60,56 @@ class StaticArgumentsFn {
// name
var StaticName_Anonymous = class {
static name: number; // error
static name: number; // error without useDefineForClassFields
name: string; // ok
}
var StaticNameFn_Anonymous = class {
static name() {} // error
static name() {} // error without useDefineForClassFields
name() {} // ok
}
// length
var StaticLength_Anonymous = class {
static length: number; // error
static length: number; // error without useDefineForClassFields
length: string; // ok
}
var StaticLengthFn_Anonymous = class {
static length() {} // error
static length() {} // error without useDefineForClassFields
length() {} // ok
}
// prototype
var StaticPrototype_Anonymous = class {
static prototype: number; // error
static prototype: number; // always an error
prototype: string; // ok
}
var StaticPrototypeFn_Anonymous = class {
static prototype() {} // error
static prototype() {} // always an error
prototype() {} // ok
}
// caller
var StaticCaller_Anonymous = class {
static caller: number; // error
static caller: number; // error without useDefineForClassFields
caller: string; // ok
}
var StaticCallerFn_Anonymous = class {
static caller() {} // error
static caller() {} // error without useDefineForClassFields
caller() {} // ok
}
// arguments
var StaticArguments_Anonymous = class {
static arguments: number; // error
static arguments: number; // error without useDefineForClassFields
arguments: string; // ok
}
var StaticArgumentsFn_Anonymous = class {
static arguments() {} // error
static arguments() {} // error without useDefineForClassFields
arguments() {} // ok
}
@ -119,14 +119,14 @@ var StaticArgumentsFn_Anonymous = class {
// name
module TestOnDefaultExportedClass_1 {
class StaticName {
static name: number; // error
static name: number; // error without useDefineForClassFields
name: string; // ok
}
}
module TestOnDefaultExportedClass_2 {
class StaticNameFn {
static name() {} // error
static name() {} // error without useDefineForClassFields
name() {} // ok
}
}
@ -134,29 +134,29 @@ module TestOnDefaultExportedClass_2 {
// length
module TestOnDefaultExportedClass_3 {
export default class StaticLength {
static length: number; // error
static length: number; // error without useDefineForClassFields
length: string; // ok
}
}
module TestOnDefaultExportedClass_4 {
export default class StaticLengthFn {
static length() {} // error
static length() {} // error without useDefineForClassFields
length() {} // ok
}
}
// prototype
module TestOnDefaultExportedClass_5 {
module TestOnDefaultExportedClass_5 {
export default class StaticPrototype {
static prototype: number; // error
static prototype: number; // always an error
prototype: string; // ok
}
}
module TestOnDefaultExportedClass_6 {
export default class StaticPrototypeFn {
static prototype() {} // error
static prototype() {} // always an error
prototype() {} // ok
}
}
@ -164,14 +164,14 @@ module TestOnDefaultExportedClass_6 {
// caller
module TestOnDefaultExportedClass_7 {
export default class StaticCaller {
static caller: number; // error
static caller: number; // error without useDefineForClassFields
caller: string; // ok
}
}
module TestOnDefaultExportedClass_8 {
export default class StaticCallerFn {
static caller() {} // error
static caller() {} // error without useDefineForClassFields
caller() {} // ok
}
}
@ -179,17 +179,18 @@ module TestOnDefaultExportedClass_8 {
// arguments
module TestOnDefaultExportedClass_9 {
export default class StaticArguments {
static arguments: number; // error
static arguments: number; // error without useDefineForClassFields
arguments: string; // ok
}
}
module TestOnDefaultExportedClass_10 {
export default class StaticArgumentsFn {
static arguments() {} // error
static arguments() {} // error without useDefineForClassFields
arguments() {} // ok
}
}
}
//// [staticPropertyNameConflicts.js]
// name
@ -201,7 +202,7 @@ var StaticName = /** @class */ (function () {
var StaticNameFn = /** @class */ (function () {
function StaticNameFn() {
}
StaticNameFn.name = function () { }; // error
StaticNameFn.name = function () { }; // error without useDefineForClassFields
StaticNameFn.prototype.name = function () { }; // ok
return StaticNameFn;
}());
@ -214,7 +215,7 @@ var StaticLength = /** @class */ (function () {
var StaticLengthFn = /** @class */ (function () {
function StaticLengthFn() {
}
StaticLengthFn.length = function () { }; // error
StaticLengthFn.length = function () { }; // error without useDefineForClassFields
StaticLengthFn.prototype.length = function () { }; // ok
return StaticLengthFn;
}());
@ -227,7 +228,7 @@ var StaticPrototype = /** @class */ (function () {
var StaticPrototypeFn = /** @class */ (function () {
function StaticPrototypeFn() {
}
StaticPrototypeFn.prototype = function () { }; // error
StaticPrototypeFn.prototype = function () { }; // always an error
StaticPrototypeFn.prototype.prototype = function () { }; // ok
return StaticPrototypeFn;
}());
@ -240,7 +241,7 @@ var StaticCaller = /** @class */ (function () {
var StaticCallerFn = /** @class */ (function () {
function StaticCallerFn() {
}
StaticCallerFn.caller = function () { }; // error
StaticCallerFn.caller = function () { }; // error without useDefineForClassFields
StaticCallerFn.prototype.caller = function () { }; // ok
return StaticCallerFn;
}());
@ -253,7 +254,7 @@ var StaticArguments = /** @class */ (function () {
var StaticArgumentsFn = /** @class */ (function () {
function StaticArgumentsFn() {
}
StaticArgumentsFn.arguments = function () { }; // error
StaticArgumentsFn.arguments = function () { }; // error without useDefineForClassFields
StaticArgumentsFn.prototype.arguments = function () { }; // ok
return StaticArgumentsFn;
}());
@ -267,7 +268,7 @@ var StaticName_Anonymous = /** @class */ (function () {
var StaticNameFn_Anonymous = /** @class */ (function () {
function StaticNameFn_Anonymous() {
}
StaticNameFn_Anonymous.name = function () { }; // error
StaticNameFn_Anonymous.name = function () { }; // error without useDefineForClassFields
StaticNameFn_Anonymous.prototype.name = function () { }; // ok
return StaticNameFn_Anonymous;
}());
@ -280,7 +281,7 @@ var StaticLength_Anonymous = /** @class */ (function () {
var StaticLengthFn_Anonymous = /** @class */ (function () {
function StaticLengthFn_Anonymous() {
}
StaticLengthFn_Anonymous.length = function () { }; // error
StaticLengthFn_Anonymous.length = function () { }; // error without useDefineForClassFields
StaticLengthFn_Anonymous.prototype.length = function () { }; // ok
return StaticLengthFn_Anonymous;
}());
@ -293,7 +294,7 @@ var StaticPrototype_Anonymous = /** @class */ (function () {
var StaticPrototypeFn_Anonymous = /** @class */ (function () {
function StaticPrototypeFn_Anonymous() {
}
StaticPrototypeFn_Anonymous.prototype = function () { }; // error
StaticPrototypeFn_Anonymous.prototype = function () { }; // always an error
StaticPrototypeFn_Anonymous.prototype.prototype = function () { }; // ok
return StaticPrototypeFn_Anonymous;
}());
@ -306,7 +307,7 @@ var StaticCaller_Anonymous = /** @class */ (function () {
var StaticCallerFn_Anonymous = /** @class */ (function () {
function StaticCallerFn_Anonymous() {
}
StaticCallerFn_Anonymous.caller = function () { }; // error
StaticCallerFn_Anonymous.caller = function () { }; // error without useDefineForClassFields
StaticCallerFn_Anonymous.prototype.caller = function () { }; // ok
return StaticCallerFn_Anonymous;
}());
@ -319,7 +320,7 @@ var StaticArguments_Anonymous = /** @class */ (function () {
var StaticArgumentsFn_Anonymous = /** @class */ (function () {
function StaticArgumentsFn_Anonymous() {
}
StaticArgumentsFn_Anonymous.arguments = function () { }; // error
StaticArgumentsFn_Anonymous.arguments = function () { }; // error without useDefineForClassFields
StaticArgumentsFn_Anonymous.prototype.arguments = function () { }; // ok
return StaticArgumentsFn_Anonymous;
}());
@ -338,7 +339,7 @@ var TestOnDefaultExportedClass_2;
var StaticNameFn = /** @class */ (function () {
function StaticNameFn() {
}
StaticNameFn.name = function () { }; // error
StaticNameFn.name = function () { }; // error without useDefineForClassFields
StaticNameFn.prototype.name = function () { }; // ok
return StaticNameFn;
}());
@ -358,7 +359,7 @@ var TestOnDefaultExportedClass_4;
var StaticLengthFn = /** @class */ (function () {
function StaticLengthFn() {
}
StaticLengthFn.length = function () { }; // error
StaticLengthFn.length = function () { }; // error without useDefineForClassFields
StaticLengthFn.prototype.length = function () { }; // ok
return StaticLengthFn;
}());
@ -379,7 +380,7 @@ var TestOnDefaultExportedClass_6;
var StaticPrototypeFn = /** @class */ (function () {
function StaticPrototypeFn() {
}
StaticPrototypeFn.prototype = function () { }; // error
StaticPrototypeFn.prototype = function () { }; // always an error
StaticPrototypeFn.prototype.prototype = function () { }; // ok
return StaticPrototypeFn;
}());
@ -400,7 +401,7 @@ var TestOnDefaultExportedClass_8;
var StaticCallerFn = /** @class */ (function () {
function StaticCallerFn() {
}
StaticCallerFn.caller = function () { }; // error
StaticCallerFn.caller = function () { }; // error without useDefineForClassFields
StaticCallerFn.prototype.caller = function () { }; // ok
return StaticCallerFn;
}());
@ -421,7 +422,7 @@ var TestOnDefaultExportedClass_10;
var StaticArgumentsFn = /** @class */ (function () {
function StaticArgumentsFn() {
}
StaticArgumentsFn.arguments = function () { }; // error
StaticArgumentsFn.arguments = function () { }; // error without useDefineForClassFields
StaticArgumentsFn.prototype.arguments = function () { }; // ok
return StaticArgumentsFn;
}());

View File

@ -3,7 +3,7 @@
class StaticName {
>StaticName : Symbol(StaticName, Decl(staticPropertyNameConflicts.ts, 0, 0))
static name: number; // error
static name: number; // error without useDefineForClassFields
>name : Symbol(StaticName.name, Decl(staticPropertyNameConflicts.ts, 1, 18))
name: string; // ok
@ -13,7 +13,7 @@ class StaticName {
class StaticNameFn {
>StaticNameFn : Symbol(StaticNameFn, Decl(staticPropertyNameConflicts.ts, 4, 1))
static name() {} // error
static name() {} // error without useDefineForClassFields
>name : Symbol(StaticNameFn.name, Decl(staticPropertyNameConflicts.ts, 6, 20))
name() {} // ok
@ -24,7 +24,7 @@ class StaticNameFn {
class StaticLength {
>StaticLength : Symbol(StaticLength, Decl(staticPropertyNameConflicts.ts, 9, 1))
static length: number; // error
static length: number; // error without useDefineForClassFields
>length : Symbol(StaticLength.length, Decl(staticPropertyNameConflicts.ts, 12, 20))
length: string; // ok
@ -34,7 +34,7 @@ class StaticLength {
class StaticLengthFn {
>StaticLengthFn : Symbol(StaticLengthFn, Decl(staticPropertyNameConflicts.ts, 15, 1))
static length() {} // error
static length() {} // error without useDefineForClassFields
>length : Symbol(StaticLengthFn.length, Decl(staticPropertyNameConflicts.ts, 17, 22))
length() {} // ok
@ -45,7 +45,7 @@ class StaticLengthFn {
class StaticPrototype {
>StaticPrototype : Symbol(StaticPrototype, Decl(staticPropertyNameConflicts.ts, 20, 1))
static prototype: number; // error
static prototype: number; // always an error
>prototype : Symbol(StaticPrototype.prototype, Decl(staticPropertyNameConflicts.ts, 23, 23))
prototype: string; // ok
@ -55,7 +55,7 @@ class StaticPrototype {
class StaticPrototypeFn {
>StaticPrototypeFn : Symbol(StaticPrototypeFn, Decl(staticPropertyNameConflicts.ts, 26, 1))
static prototype() {} // error
static prototype() {} // always an error
>prototype : Symbol(StaticPrototypeFn.prototype, Decl(staticPropertyNameConflicts.ts, 28, 25))
prototype() {} // ok
@ -66,7 +66,7 @@ class StaticPrototypeFn {
class StaticCaller {
>StaticCaller : Symbol(StaticCaller, Decl(staticPropertyNameConflicts.ts, 31, 1))
static caller: number; // error
static caller: number; // error without useDefineForClassFields
>caller : Symbol(StaticCaller.caller, Decl(staticPropertyNameConflicts.ts, 34, 20))
caller: string; // ok
@ -76,7 +76,7 @@ class StaticCaller {
class StaticCallerFn {
>StaticCallerFn : Symbol(StaticCallerFn, Decl(staticPropertyNameConflicts.ts, 37, 1))
static caller() {} // error
static caller() {} // error without useDefineForClassFields
>caller : Symbol(StaticCallerFn.caller, Decl(staticPropertyNameConflicts.ts, 39, 22))
caller() {} // ok
@ -87,7 +87,7 @@ class StaticCallerFn {
class StaticArguments {
>StaticArguments : Symbol(StaticArguments, Decl(staticPropertyNameConflicts.ts, 42, 1))
static arguments: number; // error
static arguments: number; // error without useDefineForClassFields
>arguments : Symbol(StaticArguments.arguments, Decl(staticPropertyNameConflicts.ts, 45, 23))
arguments: string; // ok
@ -97,7 +97,7 @@ class StaticArguments {
class StaticArgumentsFn {
>StaticArgumentsFn : Symbol(StaticArgumentsFn, Decl(staticPropertyNameConflicts.ts, 48, 1))
static arguments() {} // error
static arguments() {} // error without useDefineForClassFields
>arguments : Symbol(StaticArgumentsFn.arguments, Decl(staticPropertyNameConflicts.ts, 50, 25))
arguments() {} // ok
@ -112,7 +112,7 @@ class StaticArgumentsFn {
var StaticName_Anonymous = class {
>StaticName_Anonymous : Symbol(StaticName_Anonymous, Decl(staticPropertyNameConflicts.ts, 60, 3))
static name: number; // error
static name: number; // error without useDefineForClassFields
>name : Symbol(StaticName_Anonymous.name, Decl(staticPropertyNameConflicts.ts, 60, 34))
name: string; // ok
@ -122,7 +122,7 @@ var StaticName_Anonymous = class {
var StaticNameFn_Anonymous = class {
>StaticNameFn_Anonymous : Symbol(StaticNameFn_Anonymous, Decl(staticPropertyNameConflicts.ts, 65, 3))
static name() {} // error
static name() {} // error without useDefineForClassFields
>name : Symbol(StaticNameFn_Anonymous.name, Decl(staticPropertyNameConflicts.ts, 65, 36))
name() {} // ok
@ -133,7 +133,7 @@ var StaticNameFn_Anonymous = class {
var StaticLength_Anonymous = class {
>StaticLength_Anonymous : Symbol(StaticLength_Anonymous, Decl(staticPropertyNameConflicts.ts, 71, 3))
static length: number; // error
static length: number; // error without useDefineForClassFields
>length : Symbol(StaticLength_Anonymous.length, Decl(staticPropertyNameConflicts.ts, 71, 36))
length: string; // ok
@ -143,7 +143,7 @@ var StaticLength_Anonymous = class {
var StaticLengthFn_Anonymous = class {
>StaticLengthFn_Anonymous : Symbol(StaticLengthFn_Anonymous, Decl(staticPropertyNameConflicts.ts, 76, 3))
static length() {} // error
static length() {} // error without useDefineForClassFields
>length : Symbol(StaticLengthFn_Anonymous.length, Decl(staticPropertyNameConflicts.ts, 76, 38))
length() {} // ok
@ -154,7 +154,7 @@ var StaticLengthFn_Anonymous = class {
var StaticPrototype_Anonymous = class {
>StaticPrototype_Anonymous : Symbol(StaticPrototype_Anonymous, Decl(staticPropertyNameConflicts.ts, 82, 3))
static prototype: number; // error
static prototype: number; // always an error
>prototype : Symbol(StaticPrototype_Anonymous.prototype, Decl(staticPropertyNameConflicts.ts, 82, 39))
prototype: string; // ok
@ -164,7 +164,7 @@ var StaticPrototype_Anonymous = class {
var StaticPrototypeFn_Anonymous = class {
>StaticPrototypeFn_Anonymous : Symbol(StaticPrototypeFn_Anonymous, Decl(staticPropertyNameConflicts.ts, 87, 3))
static prototype() {} // error
static prototype() {} // always an error
>prototype : Symbol(StaticPrototypeFn_Anonymous.prototype, Decl(staticPropertyNameConflicts.ts, 87, 41))
prototype() {} // ok
@ -175,7 +175,7 @@ var StaticPrototypeFn_Anonymous = class {
var StaticCaller_Anonymous = class {
>StaticCaller_Anonymous : Symbol(StaticCaller_Anonymous, Decl(staticPropertyNameConflicts.ts, 93, 3))
static caller: number; // error
static caller: number; // error without useDefineForClassFields
>caller : Symbol(StaticCaller_Anonymous.caller, Decl(staticPropertyNameConflicts.ts, 93, 36))
caller: string; // ok
@ -185,7 +185,7 @@ var StaticCaller_Anonymous = class {
var StaticCallerFn_Anonymous = class {
>StaticCallerFn_Anonymous : Symbol(StaticCallerFn_Anonymous, Decl(staticPropertyNameConflicts.ts, 98, 3))
static caller() {} // error
static caller() {} // error without useDefineForClassFields
>caller : Symbol(StaticCallerFn_Anonymous.caller, Decl(staticPropertyNameConflicts.ts, 98, 38))
caller() {} // ok
@ -196,7 +196,7 @@ var StaticCallerFn_Anonymous = class {
var StaticArguments_Anonymous = class {
>StaticArguments_Anonymous : Symbol(StaticArguments_Anonymous, Decl(staticPropertyNameConflicts.ts, 104, 3))
static arguments: number; // error
static arguments: number; // error without useDefineForClassFields
>arguments : Symbol(StaticArguments_Anonymous.arguments, Decl(staticPropertyNameConflicts.ts, 104, 39))
arguments: string; // ok
@ -206,7 +206,7 @@ var StaticArguments_Anonymous = class {
var StaticArgumentsFn_Anonymous = class {
>StaticArgumentsFn_Anonymous : Symbol(StaticArgumentsFn_Anonymous, Decl(staticPropertyNameConflicts.ts, 109, 3))
static arguments() {} // error
static arguments() {} // error without useDefineForClassFields
>arguments : Symbol(StaticArgumentsFn_Anonymous.arguments, Decl(staticPropertyNameConflicts.ts, 109, 41))
arguments() {} // ok
@ -223,7 +223,7 @@ module TestOnDefaultExportedClass_1 {
class StaticName {
>StaticName : Symbol(StaticName, Decl(staticPropertyNameConflicts.ts, 118, 37))
static name: number; // error
static name: number; // error without useDefineForClassFields
>name : Symbol(StaticName.name, Decl(staticPropertyNameConflicts.ts, 119, 22))
name: string; // ok
@ -237,7 +237,7 @@ module TestOnDefaultExportedClass_2 {
class StaticNameFn {
>StaticNameFn : Symbol(StaticNameFn, Decl(staticPropertyNameConflicts.ts, 125, 37))
static name() {} // error
static name() {} // error without useDefineForClassFields
>name : Symbol(StaticNameFn.name, Decl(staticPropertyNameConflicts.ts, 126, 24))
name() {} // ok
@ -252,7 +252,7 @@ module TestOnDefaultExportedClass_3 {
export default class StaticLength {
>StaticLength : Symbol(StaticLength, Decl(staticPropertyNameConflicts.ts, 133, 37))
static length: number; // error
static length: number; // error without useDefineForClassFields
>length : Symbol(StaticLength.length, Decl(staticPropertyNameConflicts.ts, 134, 39))
length: string; // ok
@ -266,7 +266,7 @@ module TestOnDefaultExportedClass_4 {
export default class StaticLengthFn {
>StaticLengthFn : Symbol(StaticLengthFn, Decl(staticPropertyNameConflicts.ts, 140, 37))
static length() {} // error
static length() {} // error without useDefineForClassFields
>length : Symbol(StaticLengthFn.length, Decl(staticPropertyNameConflicts.ts, 141, 41))
length() {} // ok
@ -275,13 +275,13 @@ module TestOnDefaultExportedClass_4 {
}
// prototype
module TestOnDefaultExportedClass_5 {
module TestOnDefaultExportedClass_5 {
>TestOnDefaultExportedClass_5 : Symbol(TestOnDefaultExportedClass_5, Decl(staticPropertyNameConflicts.ts, 145, 1))
export default class StaticPrototype {
>StaticPrototype : Symbol(StaticPrototype, Decl(staticPropertyNameConflicts.ts, 148, 37))
static prototype: number; // error
static prototype: number; // always an error
>prototype : Symbol(StaticPrototype.prototype, Decl(staticPropertyNameConflicts.ts, 149, 42))
prototype: string; // ok
@ -295,7 +295,7 @@ module TestOnDefaultExportedClass_6 {
export default class StaticPrototypeFn {
>StaticPrototypeFn : Symbol(StaticPrototypeFn, Decl(staticPropertyNameConflicts.ts, 155, 37))
static prototype() {} // error
static prototype() {} // always an error
>prototype : Symbol(StaticPrototypeFn.prototype, Decl(staticPropertyNameConflicts.ts, 156, 44))
prototype() {} // ok
@ -310,7 +310,7 @@ module TestOnDefaultExportedClass_7 {
export default class StaticCaller {
>StaticCaller : Symbol(StaticCaller, Decl(staticPropertyNameConflicts.ts, 163, 37))
static caller: number; // error
static caller: number; // error without useDefineForClassFields
>caller : Symbol(StaticCaller.caller, Decl(staticPropertyNameConflicts.ts, 164, 39))
caller: string; // ok
@ -324,7 +324,7 @@ module TestOnDefaultExportedClass_8 {
export default class StaticCallerFn {
>StaticCallerFn : Symbol(StaticCallerFn, Decl(staticPropertyNameConflicts.ts, 170, 37))
static caller() {} // error
static caller() {} // error without useDefineForClassFields
>caller : Symbol(StaticCallerFn.caller, Decl(staticPropertyNameConflicts.ts, 171, 41))
caller() {} // ok
@ -339,7 +339,7 @@ module TestOnDefaultExportedClass_9 {
export default class StaticArguments {
>StaticArguments : Symbol(StaticArguments, Decl(staticPropertyNameConflicts.ts, 178, 37))
static arguments: number; // error
static arguments: number; // error without useDefineForClassFields
>arguments : Symbol(StaticArguments.arguments, Decl(staticPropertyNameConflicts.ts, 179, 42))
arguments: string; // ok
@ -353,10 +353,11 @@ module TestOnDefaultExportedClass_10 {
export default class StaticArgumentsFn {
>StaticArgumentsFn : Symbol(StaticArgumentsFn, Decl(staticPropertyNameConflicts.ts, 185, 38))
static arguments() {} // error
static arguments() {} // error without useDefineForClassFields
>arguments : Symbol(StaticArgumentsFn.arguments, Decl(staticPropertyNameConflicts.ts, 186, 44))
arguments() {} // ok
>arguments : Symbol(StaticArgumentsFn.arguments, Decl(staticPropertyNameConflicts.ts, 187, 29))
}
}

View File

@ -3,7 +3,7 @@
class StaticName {
>StaticName : StaticName
static name: number; // error
static name: number; // error without useDefineForClassFields
>name : number
name: string; // ok
@ -13,7 +13,7 @@ class StaticName {
class StaticNameFn {
>StaticNameFn : StaticNameFn
static name() {} // error
static name() {} // error without useDefineForClassFields
>name : () => void
name() {} // ok
@ -24,7 +24,7 @@ class StaticNameFn {
class StaticLength {
>StaticLength : StaticLength
static length: number; // error
static length: number; // error without useDefineForClassFields
>length : number
length: string; // ok
@ -34,7 +34,7 @@ class StaticLength {
class StaticLengthFn {
>StaticLengthFn : StaticLengthFn
static length() {} // error
static length() {} // error without useDefineForClassFields
>length : () => void
length() {} // ok
@ -45,7 +45,7 @@ class StaticLengthFn {
class StaticPrototype {
>StaticPrototype : StaticPrototype
static prototype: number; // error
static prototype: number; // always an error
>prototype : StaticPrototype
prototype: string; // ok
@ -55,7 +55,7 @@ class StaticPrototype {
class StaticPrototypeFn {
>StaticPrototypeFn : StaticPrototypeFn
static prototype() {} // error
static prototype() {} // always an error
>prototype : () => void
prototype() {} // ok
@ -66,7 +66,7 @@ class StaticPrototypeFn {
class StaticCaller {
>StaticCaller : StaticCaller
static caller: number; // error
static caller: number; // error without useDefineForClassFields
>caller : number
caller: string; // ok
@ -76,7 +76,7 @@ class StaticCaller {
class StaticCallerFn {
>StaticCallerFn : StaticCallerFn
static caller() {} // error
static caller() {} // error without useDefineForClassFields
>caller : () => void
caller() {} // ok
@ -87,7 +87,7 @@ class StaticCallerFn {
class StaticArguments {
>StaticArguments : StaticArguments
static arguments: number; // error
static arguments: number; // error without useDefineForClassFields
>arguments : number
arguments: string; // ok
@ -97,7 +97,7 @@ class StaticArguments {
class StaticArgumentsFn {
>StaticArgumentsFn : StaticArgumentsFn
static arguments() {} // error
static arguments() {} // error without useDefineForClassFields
>arguments : () => void
arguments() {} // ok
@ -111,9 +111,9 @@ class StaticArgumentsFn {
// name
var StaticName_Anonymous = class {
>StaticName_Anonymous : typeof StaticName_Anonymous
>class { static name: number; // error name: string; // ok} : typeof StaticName_Anonymous
>class { static name: number; // error without useDefineForClassFields name: string; // ok} : typeof StaticName_Anonymous
static name: number; // error
static name: number; // error without useDefineForClassFields
>name : number
name: string; // ok
@ -122,9 +122,9 @@ var StaticName_Anonymous = class {
var StaticNameFn_Anonymous = class {
>StaticNameFn_Anonymous : typeof StaticNameFn_Anonymous
>class { static name() {} // error name() {} // ok} : typeof StaticNameFn_Anonymous
>class { static name() {} // error without useDefineForClassFields name() {} // ok} : typeof StaticNameFn_Anonymous
static name() {} // error
static name() {} // error without useDefineForClassFields
>name : () => void
name() {} // ok
@ -134,9 +134,9 @@ var StaticNameFn_Anonymous = class {
// length
var StaticLength_Anonymous = class {
>StaticLength_Anonymous : typeof StaticLength_Anonymous
>class { static length: number; // error length: string; // ok} : typeof StaticLength_Anonymous
>class { static length: number; // error without useDefineForClassFields length: string; // ok} : typeof StaticLength_Anonymous
static length: number; // error
static length: number; // error without useDefineForClassFields
>length : number
length: string; // ok
@ -145,9 +145,9 @@ var StaticLength_Anonymous = class {
var StaticLengthFn_Anonymous = class {
>StaticLengthFn_Anonymous : typeof StaticLengthFn_Anonymous
>class { static length() {} // error length() {} // ok} : typeof StaticLengthFn_Anonymous
>class { static length() {} // error without useDefineForClassFields length() {} // ok} : typeof StaticLengthFn_Anonymous
static length() {} // error
static length() {} // error without useDefineForClassFields
>length : () => void
length() {} // ok
@ -157,9 +157,9 @@ var StaticLengthFn_Anonymous = class {
// prototype
var StaticPrototype_Anonymous = class {
>StaticPrototype_Anonymous : typeof StaticPrototype_Anonymous
>class { static prototype: number; // error prototype: string; // ok} : typeof StaticPrototype_Anonymous
>class { static prototype: number; // always an error prototype: string; // ok} : typeof StaticPrototype_Anonymous
static prototype: number; // error
static prototype: number; // always an error
>prototype : StaticPrototype_Anonymous
prototype: string; // ok
@ -168,9 +168,9 @@ var StaticPrototype_Anonymous = class {
var StaticPrototypeFn_Anonymous = class {
>StaticPrototypeFn_Anonymous : typeof StaticPrototypeFn_Anonymous
>class { static prototype() {} // error prototype() {} // ok} : typeof StaticPrototypeFn_Anonymous
>class { static prototype() {} // always an error prototype() {} // ok} : typeof StaticPrototypeFn_Anonymous
static prototype() {} // error
static prototype() {} // always an error
>prototype : () => void
prototype() {} // ok
@ -180,9 +180,9 @@ var StaticPrototypeFn_Anonymous = class {
// caller
var StaticCaller_Anonymous = class {
>StaticCaller_Anonymous : typeof StaticCaller_Anonymous
>class { static caller: number; // error caller: string; // ok} : typeof StaticCaller_Anonymous
>class { static caller: number; // error without useDefineForClassFields caller: string; // ok} : typeof StaticCaller_Anonymous
static caller: number; // error
static caller: number; // error without useDefineForClassFields
>caller : number
caller: string; // ok
@ -191,9 +191,9 @@ var StaticCaller_Anonymous = class {
var StaticCallerFn_Anonymous = class {
>StaticCallerFn_Anonymous : typeof StaticCallerFn_Anonymous
>class { static caller() {} // error caller() {} // ok} : typeof StaticCallerFn_Anonymous
>class { static caller() {} // error without useDefineForClassFields caller() {} // ok} : typeof StaticCallerFn_Anonymous
static caller() {} // error
static caller() {} // error without useDefineForClassFields
>caller : () => void
caller() {} // ok
@ -203,9 +203,9 @@ var StaticCallerFn_Anonymous = class {
// arguments
var StaticArguments_Anonymous = class {
>StaticArguments_Anonymous : typeof StaticArguments_Anonymous
>class { static arguments: number; // error arguments: string; // ok} : typeof StaticArguments_Anonymous
>class { static arguments: number; // error without useDefineForClassFields arguments: string; // ok} : typeof StaticArguments_Anonymous
static arguments: number; // error
static arguments: number; // error without useDefineForClassFields
>arguments : number
arguments: string; // ok
@ -214,9 +214,9 @@ var StaticArguments_Anonymous = class {
var StaticArgumentsFn_Anonymous = class {
>StaticArgumentsFn_Anonymous : typeof StaticArgumentsFn_Anonymous
>class { static arguments() {} // error arguments() {} // ok} : typeof StaticArgumentsFn_Anonymous
>class { static arguments() {} // error without useDefineForClassFields arguments() {} // ok} : typeof StaticArgumentsFn_Anonymous
static arguments() {} // error
static arguments() {} // error without useDefineForClassFields
>arguments : () => void
arguments() {} // ok
@ -233,7 +233,7 @@ module TestOnDefaultExportedClass_1 {
class StaticName {
>StaticName : StaticName
static name: number; // error
static name: number; // error without useDefineForClassFields
>name : number
name: string; // ok
@ -247,7 +247,7 @@ module TestOnDefaultExportedClass_2 {
class StaticNameFn {
>StaticNameFn : StaticNameFn
static name() {} // error
static name() {} // error without useDefineForClassFields
>name : () => void
name() {} // ok
@ -262,7 +262,7 @@ module TestOnDefaultExportedClass_3 {
export default class StaticLength {
>StaticLength : StaticLength
static length: number; // error
static length: number; // error without useDefineForClassFields
>length : number
length: string; // ok
@ -276,7 +276,7 @@ module TestOnDefaultExportedClass_4 {
export default class StaticLengthFn {
>StaticLengthFn : StaticLengthFn
static length() {} // error
static length() {} // error without useDefineForClassFields
>length : () => void
length() {} // ok
@ -285,13 +285,13 @@ module TestOnDefaultExportedClass_4 {
}
// prototype
module TestOnDefaultExportedClass_5 {
module TestOnDefaultExportedClass_5 {
>TestOnDefaultExportedClass_5 : typeof TestOnDefaultExportedClass_5
export default class StaticPrototype {
>StaticPrototype : StaticPrototype
static prototype: number; // error
static prototype: number; // always an error
>prototype : StaticPrototype
prototype: string; // ok
@ -305,7 +305,7 @@ module TestOnDefaultExportedClass_6 {
export default class StaticPrototypeFn {
>StaticPrototypeFn : StaticPrototypeFn
static prototype() {} // error
static prototype() {} // always an error
>prototype : () => void
prototype() {} // ok
@ -320,7 +320,7 @@ module TestOnDefaultExportedClass_7 {
export default class StaticCaller {
>StaticCaller : StaticCaller
static caller: number; // error
static caller: number; // error without useDefineForClassFields
>caller : number
caller: string; // ok
@ -334,7 +334,7 @@ module TestOnDefaultExportedClass_8 {
export default class StaticCallerFn {
>StaticCallerFn : StaticCallerFn
static caller() {} // error
static caller() {} // error without useDefineForClassFields
>caller : () => void
caller() {} // ok
@ -349,7 +349,7 @@ module TestOnDefaultExportedClass_9 {
export default class StaticArguments {
>StaticArguments : StaticArguments
static arguments: number; // error
static arguments: number; // error without useDefineForClassFields
>arguments : number
arguments: string; // ok
@ -363,10 +363,11 @@ module TestOnDefaultExportedClass_10 {
export default class StaticArgumentsFn {
>StaticArgumentsFn : StaticArgumentsFn
static arguments() {} // error
static arguments() {} // error without useDefineForClassFields
>arguments : () => void
arguments() {} // ok
>arguments : () => void
}
}

View File

@ -0,0 +1,246 @@
tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(25,12): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototype'.
tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(30,12): error TS2300: Duplicate identifier 'prototype'.
tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(30,12): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototypeFn'.
tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(84,12): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototype_Anonymous'.
tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(89,12): error TS2300: Duplicate identifier 'prototype'.
tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(89,12): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototypeFn_Anonymous'.
tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(135,12): error TS1319: A default export can only be used in an ECMAScript-style module.
tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(142,12): error TS1319: A default export can only be used in an ECMAScript-style module.
tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(150,12): error TS1319: A default export can only be used in an ECMAScript-style module.
tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(151,16): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototype'.
tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(157,12): error TS1319: A default export can only be used in an ECMAScript-style module.
tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(158,16): error TS2300: Duplicate identifier 'prototype'.
tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(158,16): error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototypeFn'.
tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(165,12): error TS1319: A default export can only be used in an ECMAScript-style module.
tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(172,12): error TS1319: A default export can only be used in an ECMAScript-style module.
tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(180,12): error TS1319: A default export can only be used in an ECMAScript-style module.
tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts(187,12): error TS1319: A default export can only be used in an ECMAScript-style module.
==== tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts (17 errors) ====
// name
class StaticName {
static name: number; // error without useDefineForClassFields
name: string; // ok
}
class StaticNameFn {
static name() {} // error without useDefineForClassFields
name() {} // ok
}
// length
class StaticLength {
static length: number; // error without useDefineForClassFields
length: string; // ok
}
class StaticLengthFn {
static length() {} // error without useDefineForClassFields
length() {} // ok
}
// prototype
class StaticPrototype {
static prototype: number; // always an error
~~~~~~~~~
!!! error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototype'.
prototype: string; // ok
}
class StaticPrototypeFn {
static prototype() {} // always an error
~~~~~~~~~
!!! error TS2300: Duplicate identifier 'prototype'.
~~~~~~~~~
!!! error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototypeFn'.
prototype() {} // ok
}
// caller
class StaticCaller {
static caller: number; // error without useDefineForClassFields
caller: string; // ok
}
class StaticCallerFn {
static caller() {} // error without useDefineForClassFields
caller() {} // ok
}
// arguments
class StaticArguments {
static arguments: number; // error without useDefineForClassFields
arguments: string; // ok
}
class StaticArgumentsFn {
static arguments() {} // error without useDefineForClassFields
arguments() {} // ok
}
// === Static properties on anonymous classes ===
// name
var StaticName_Anonymous = class {
static name: number; // error without useDefineForClassFields
name: string; // ok
}
var StaticNameFn_Anonymous = class {
static name() {} // error without useDefineForClassFields
name() {} // ok
}
// length
var StaticLength_Anonymous = class {
static length: number; // error without useDefineForClassFields
length: string; // ok
}
var StaticLengthFn_Anonymous = class {
static length() {} // error without useDefineForClassFields
length() {} // ok
}
// prototype
var StaticPrototype_Anonymous = class {
static prototype: number; // always an error
~~~~~~~~~
!!! error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototype_Anonymous'.
prototype: string; // ok
}
var StaticPrototypeFn_Anonymous = class {
static prototype() {} // always an error
~~~~~~~~~
!!! error TS2300: Duplicate identifier 'prototype'.
~~~~~~~~~
!!! error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototypeFn_Anonymous'.
prototype() {} // ok
}
// caller
var StaticCaller_Anonymous = class {
static caller: number; // error without useDefineForClassFields
caller: string; // ok
}
var StaticCallerFn_Anonymous = class {
static caller() {} // error without useDefineForClassFields
caller() {} // ok
}
// arguments
var StaticArguments_Anonymous = class {
static arguments: number; // error without useDefineForClassFields
arguments: string; // ok
}
var StaticArgumentsFn_Anonymous = class {
static arguments() {} // error without useDefineForClassFields
arguments() {} // ok
}
// === Static properties on default exported classes ===
// name
module TestOnDefaultExportedClass_1 {
class StaticName {
static name: number; // error without useDefineForClassFields
name: string; // ok
}
}
module TestOnDefaultExportedClass_2 {
class StaticNameFn {
static name() {} // error without useDefineForClassFields
name() {} // ok
}
}
// length
module TestOnDefaultExportedClass_3 {
export default class StaticLength {
~~~~~~~
!!! error TS1319: A default export can only be used in an ECMAScript-style module.
static length: number; // error without useDefineForClassFields
length: string; // ok
}
}
module TestOnDefaultExportedClass_4 {
export default class StaticLengthFn {
~~~~~~~
!!! error TS1319: A default export can only be used in an ECMAScript-style module.
static length() {} // error without useDefineForClassFields
length() {} // ok
}
}
// prototype
module TestOnDefaultExportedClass_5 {
export default class StaticPrototype {
~~~~~~~
!!! error TS1319: A default export can only be used in an ECMAScript-style module.
static prototype: number; // always an error
~~~~~~~~~
!!! error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototype'.
prototype: string; // ok
}
}
module TestOnDefaultExportedClass_6 {
export default class StaticPrototypeFn {
~~~~~~~
!!! error TS1319: A default export can only be used in an ECMAScript-style module.
static prototype() {} // always an error
~~~~~~~~~
!!! error TS2300: Duplicate identifier 'prototype'.
~~~~~~~~~
!!! error TS2699: Static property 'prototype' conflicts with built-in property 'Function.prototype' of constructor function 'StaticPrototypeFn'.
prototype() {} // ok
}
}
// caller
module TestOnDefaultExportedClass_7 {
export default class StaticCaller {
~~~~~~~
!!! error TS1319: A default export can only be used in an ECMAScript-style module.
static caller: number; // error without useDefineForClassFields
caller: string; // ok
}
}
module TestOnDefaultExportedClass_8 {
export default class StaticCallerFn {
~~~~~~~
!!! error TS1319: A default export can only be used in an ECMAScript-style module.
static caller() {} // error without useDefineForClassFields
caller() {} // ok
}
}
// arguments
module TestOnDefaultExportedClass_9 {
export default class StaticArguments {
~~~~~~~
!!! error TS1319: A default export can only be used in an ECMAScript-style module.
static arguments: number; // error without useDefineForClassFields
arguments: string; // ok
}
}
module TestOnDefaultExportedClass_10 {
export default class StaticArgumentsFn {
~~~~~~~
!!! error TS1319: A default export can only be used in an ECMAScript-style module.
static arguments() {} // error without useDefineForClassFields
arguments() {} // ok
}
}

View File

@ -0,0 +1,670 @@
//// [staticPropertyNameConflicts.ts]
// name
class StaticName {
static name: number; // error without useDefineForClassFields
name: string; // ok
}
class StaticNameFn {
static name() {} // error without useDefineForClassFields
name() {} // ok
}
// length
class StaticLength {
static length: number; // error without useDefineForClassFields
length: string; // ok
}
class StaticLengthFn {
static length() {} // error without useDefineForClassFields
length() {} // ok
}
// prototype
class StaticPrototype {
static prototype: number; // always an error
prototype: string; // ok
}
class StaticPrototypeFn {
static prototype() {} // always an error
prototype() {} // ok
}
// caller
class StaticCaller {
static caller: number; // error without useDefineForClassFields
caller: string; // ok
}
class StaticCallerFn {
static caller() {} // error without useDefineForClassFields
caller() {} // ok
}
// arguments
class StaticArguments {
static arguments: number; // error without useDefineForClassFields
arguments: string; // ok
}
class StaticArgumentsFn {
static arguments() {} // error without useDefineForClassFields
arguments() {} // ok
}
// === Static properties on anonymous classes ===
// name
var StaticName_Anonymous = class {
static name: number; // error without useDefineForClassFields
name: string; // ok
}
var StaticNameFn_Anonymous = class {
static name() {} // error without useDefineForClassFields
name() {} // ok
}
// length
var StaticLength_Anonymous = class {
static length: number; // error without useDefineForClassFields
length: string; // ok
}
var StaticLengthFn_Anonymous = class {
static length() {} // error without useDefineForClassFields
length() {} // ok
}
// prototype
var StaticPrototype_Anonymous = class {
static prototype: number; // always an error
prototype: string; // ok
}
var StaticPrototypeFn_Anonymous = class {
static prototype() {} // always an error
prototype() {} // ok
}
// caller
var StaticCaller_Anonymous = class {
static caller: number; // error without useDefineForClassFields
caller: string; // ok
}
var StaticCallerFn_Anonymous = class {
static caller() {} // error without useDefineForClassFields
caller() {} // ok
}
// arguments
var StaticArguments_Anonymous = class {
static arguments: number; // error without useDefineForClassFields
arguments: string; // ok
}
var StaticArgumentsFn_Anonymous = class {
static arguments() {} // error without useDefineForClassFields
arguments() {} // ok
}
// === Static properties on default exported classes ===
// name
module TestOnDefaultExportedClass_1 {
class StaticName {
static name: number; // error without useDefineForClassFields
name: string; // ok
}
}
module TestOnDefaultExportedClass_2 {
class StaticNameFn {
static name() {} // error without useDefineForClassFields
name() {} // ok
}
}
// length
module TestOnDefaultExportedClass_3 {
export default class StaticLength {
static length: number; // error without useDefineForClassFields
length: string; // ok
}
}
module TestOnDefaultExportedClass_4 {
export default class StaticLengthFn {
static length() {} // error without useDefineForClassFields
length() {} // ok
}
}
// prototype
module TestOnDefaultExportedClass_5 {
export default class StaticPrototype {
static prototype: number; // always an error
prototype: string; // ok
}
}
module TestOnDefaultExportedClass_6 {
export default class StaticPrototypeFn {
static prototype() {} // always an error
prototype() {} // ok
}
}
// caller
module TestOnDefaultExportedClass_7 {
export default class StaticCaller {
static caller: number; // error without useDefineForClassFields
caller: string; // ok
}
}
module TestOnDefaultExportedClass_8 {
export default class StaticCallerFn {
static caller() {} // error without useDefineForClassFields
caller() {} // ok
}
}
// arguments
module TestOnDefaultExportedClass_9 {
export default class StaticArguments {
static arguments: number; // error without useDefineForClassFields
arguments: string; // ok
}
}
module TestOnDefaultExportedClass_10 {
export default class StaticArgumentsFn {
static arguments() {} // error without useDefineForClassFields
arguments() {} // ok
}
}
//// [staticPropertyNameConflicts.js]
// name
var StaticName = /** @class */ (function () {
function StaticName() {
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
}); // ok
}
return StaticName;
}());
var StaticNameFn = /** @class */ (function () {
function StaticNameFn() {
}
Object.defineProperty(StaticNameFn, "name", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // error without useDefineForClassFields
Object.defineProperty(StaticNameFn.prototype, "name", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // ok
return StaticNameFn;
}());
// length
var StaticLength = /** @class */ (function () {
function StaticLength() {
Object.defineProperty(this, "length", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
}); // ok
}
return StaticLength;
}());
var StaticLengthFn = /** @class */ (function () {
function StaticLengthFn() {
}
Object.defineProperty(StaticLengthFn, "length", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // error without useDefineForClassFields
Object.defineProperty(StaticLengthFn.prototype, "length", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // ok
return StaticLengthFn;
}());
// prototype
var StaticPrototype = /** @class */ (function () {
function StaticPrototype() {
Object.defineProperty(this, "prototype", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
}); // ok
}
return StaticPrototype;
}());
var StaticPrototypeFn = /** @class */ (function () {
function StaticPrototypeFn() {
}
Object.defineProperty(StaticPrototypeFn, "prototype", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // always an error
Object.defineProperty(StaticPrototypeFn.prototype, "prototype", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // ok
return StaticPrototypeFn;
}());
// caller
var StaticCaller = /** @class */ (function () {
function StaticCaller() {
Object.defineProperty(this, "caller", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
}); // ok
}
return StaticCaller;
}());
var StaticCallerFn = /** @class */ (function () {
function StaticCallerFn() {
}
Object.defineProperty(StaticCallerFn, "caller", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // error without useDefineForClassFields
Object.defineProperty(StaticCallerFn.prototype, "caller", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // ok
return StaticCallerFn;
}());
// arguments
var StaticArguments = /** @class */ (function () {
function StaticArguments() {
Object.defineProperty(this, "arguments", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
}); // ok
}
return StaticArguments;
}());
var StaticArgumentsFn = /** @class */ (function () {
function StaticArgumentsFn() {
}
Object.defineProperty(StaticArgumentsFn, "arguments", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // error without useDefineForClassFields
Object.defineProperty(StaticArgumentsFn.prototype, "arguments", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // ok
return StaticArgumentsFn;
}());
// === Static properties on anonymous classes ===
// name
var StaticName_Anonymous = /** @class */ (function () {
function class_1() {
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
}); // ok
}
return class_1;
}());
var StaticNameFn_Anonymous = /** @class */ (function () {
function StaticNameFn_Anonymous() {
}
Object.defineProperty(StaticNameFn_Anonymous, "name", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // error without useDefineForClassFields
Object.defineProperty(StaticNameFn_Anonymous.prototype, "name", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // ok
return StaticNameFn_Anonymous;
}());
// length
var StaticLength_Anonymous = /** @class */ (function () {
function class_2() {
Object.defineProperty(this, "length", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
}); // ok
}
return class_2;
}());
var StaticLengthFn_Anonymous = /** @class */ (function () {
function StaticLengthFn_Anonymous() {
}
Object.defineProperty(StaticLengthFn_Anonymous, "length", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // error without useDefineForClassFields
Object.defineProperty(StaticLengthFn_Anonymous.prototype, "length", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // ok
return StaticLengthFn_Anonymous;
}());
// prototype
var StaticPrototype_Anonymous = /** @class */ (function () {
function class_3() {
Object.defineProperty(this, "prototype", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
}); // ok
}
return class_3;
}());
var StaticPrototypeFn_Anonymous = /** @class */ (function () {
function StaticPrototypeFn_Anonymous() {
}
Object.defineProperty(StaticPrototypeFn_Anonymous, "prototype", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // always an error
Object.defineProperty(StaticPrototypeFn_Anonymous.prototype, "prototype", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // ok
return StaticPrototypeFn_Anonymous;
}());
// caller
var StaticCaller_Anonymous = /** @class */ (function () {
function class_4() {
Object.defineProperty(this, "caller", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
}); // ok
}
return class_4;
}());
var StaticCallerFn_Anonymous = /** @class */ (function () {
function StaticCallerFn_Anonymous() {
}
Object.defineProperty(StaticCallerFn_Anonymous, "caller", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // error without useDefineForClassFields
Object.defineProperty(StaticCallerFn_Anonymous.prototype, "caller", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // ok
return StaticCallerFn_Anonymous;
}());
// arguments
var StaticArguments_Anonymous = /** @class */ (function () {
function class_5() {
Object.defineProperty(this, "arguments", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
}); // ok
}
return class_5;
}());
var StaticArgumentsFn_Anonymous = /** @class */ (function () {
function StaticArgumentsFn_Anonymous() {
}
Object.defineProperty(StaticArgumentsFn_Anonymous, "arguments", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // error without useDefineForClassFields
Object.defineProperty(StaticArgumentsFn_Anonymous.prototype, "arguments", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // ok
return StaticArgumentsFn_Anonymous;
}());
// === Static properties on default exported classes ===
// name
var TestOnDefaultExportedClass_1;
(function (TestOnDefaultExportedClass_1) {
var StaticName = /** @class */ (function () {
function StaticName() {
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
}); // ok
}
return StaticName;
}());
})(TestOnDefaultExportedClass_1 || (TestOnDefaultExportedClass_1 = {}));
var TestOnDefaultExportedClass_2;
(function (TestOnDefaultExportedClass_2) {
var StaticNameFn = /** @class */ (function () {
function StaticNameFn() {
}
Object.defineProperty(StaticNameFn, "name", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // error without useDefineForClassFields
Object.defineProperty(StaticNameFn.prototype, "name", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // ok
return StaticNameFn;
}());
})(TestOnDefaultExportedClass_2 || (TestOnDefaultExportedClass_2 = {}));
// length
var TestOnDefaultExportedClass_3;
(function (TestOnDefaultExportedClass_3) {
var StaticLength = /** @class */ (function () {
function StaticLength() {
Object.defineProperty(this, "length", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
}); // ok
}
return StaticLength;
}());
TestOnDefaultExportedClass_3.StaticLength = StaticLength;
})(TestOnDefaultExportedClass_3 || (TestOnDefaultExportedClass_3 = {}));
var TestOnDefaultExportedClass_4;
(function (TestOnDefaultExportedClass_4) {
var StaticLengthFn = /** @class */ (function () {
function StaticLengthFn() {
}
Object.defineProperty(StaticLengthFn, "length", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // error without useDefineForClassFields
Object.defineProperty(StaticLengthFn.prototype, "length", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // ok
return StaticLengthFn;
}());
TestOnDefaultExportedClass_4.StaticLengthFn = StaticLengthFn;
})(TestOnDefaultExportedClass_4 || (TestOnDefaultExportedClass_4 = {}));
// prototype
var TestOnDefaultExportedClass_5;
(function (TestOnDefaultExportedClass_5) {
var StaticPrototype = /** @class */ (function () {
function StaticPrototype() {
Object.defineProperty(this, "prototype", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
}); // ok
}
return StaticPrototype;
}());
TestOnDefaultExportedClass_5.StaticPrototype = StaticPrototype;
})(TestOnDefaultExportedClass_5 || (TestOnDefaultExportedClass_5 = {}));
var TestOnDefaultExportedClass_6;
(function (TestOnDefaultExportedClass_6) {
var StaticPrototypeFn = /** @class */ (function () {
function StaticPrototypeFn() {
}
Object.defineProperty(StaticPrototypeFn, "prototype", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // always an error
Object.defineProperty(StaticPrototypeFn.prototype, "prototype", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // ok
return StaticPrototypeFn;
}());
TestOnDefaultExportedClass_6.StaticPrototypeFn = StaticPrototypeFn;
})(TestOnDefaultExportedClass_6 || (TestOnDefaultExportedClass_6 = {}));
// caller
var TestOnDefaultExportedClass_7;
(function (TestOnDefaultExportedClass_7) {
var StaticCaller = /** @class */ (function () {
function StaticCaller() {
Object.defineProperty(this, "caller", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
}); // ok
}
return StaticCaller;
}());
TestOnDefaultExportedClass_7.StaticCaller = StaticCaller;
})(TestOnDefaultExportedClass_7 || (TestOnDefaultExportedClass_7 = {}));
var TestOnDefaultExportedClass_8;
(function (TestOnDefaultExportedClass_8) {
var StaticCallerFn = /** @class */ (function () {
function StaticCallerFn() {
}
Object.defineProperty(StaticCallerFn, "caller", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // error without useDefineForClassFields
Object.defineProperty(StaticCallerFn.prototype, "caller", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // ok
return StaticCallerFn;
}());
TestOnDefaultExportedClass_8.StaticCallerFn = StaticCallerFn;
})(TestOnDefaultExportedClass_8 || (TestOnDefaultExportedClass_8 = {}));
// arguments
var TestOnDefaultExportedClass_9;
(function (TestOnDefaultExportedClass_9) {
var StaticArguments = /** @class */ (function () {
function StaticArguments() {
Object.defineProperty(this, "arguments", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
}); // ok
}
return StaticArguments;
}());
TestOnDefaultExportedClass_9.StaticArguments = StaticArguments;
})(TestOnDefaultExportedClass_9 || (TestOnDefaultExportedClass_9 = {}));
var TestOnDefaultExportedClass_10;
(function (TestOnDefaultExportedClass_10) {
var StaticArgumentsFn = /** @class */ (function () {
function StaticArgumentsFn() {
}
Object.defineProperty(StaticArgumentsFn, "arguments", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // error without useDefineForClassFields
Object.defineProperty(StaticArgumentsFn.prototype, "arguments", {
enumerable: false,
configurable: true,
writable: true,
value: function () { }
}); // ok
return StaticArgumentsFn;
}());
TestOnDefaultExportedClass_10.StaticArgumentsFn = StaticArgumentsFn;
})(TestOnDefaultExportedClass_10 || (TestOnDefaultExportedClass_10 = {}));

View File

@ -0,0 +1,363 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts ===
// name
class StaticName {
>StaticName : Symbol(StaticName, Decl(staticPropertyNameConflicts.ts, 0, 0))
static name: number; // error without useDefineForClassFields
>name : Symbol(StaticName.name, Decl(staticPropertyNameConflicts.ts, 1, 18))
name: string; // ok
>name : Symbol(StaticName.name, Decl(staticPropertyNameConflicts.ts, 2, 24))
}
class StaticNameFn {
>StaticNameFn : Symbol(StaticNameFn, Decl(staticPropertyNameConflicts.ts, 4, 1))
static name() {} // error without useDefineForClassFields
>name : Symbol(StaticNameFn.name, Decl(staticPropertyNameConflicts.ts, 6, 20))
name() {} // ok
>name : Symbol(StaticNameFn.name, Decl(staticPropertyNameConflicts.ts, 7, 20))
}
// length
class StaticLength {
>StaticLength : Symbol(StaticLength, Decl(staticPropertyNameConflicts.ts, 9, 1))
static length: number; // error without useDefineForClassFields
>length : Symbol(StaticLength.length, Decl(staticPropertyNameConflicts.ts, 12, 20))
length: string; // ok
>length : Symbol(StaticLength.length, Decl(staticPropertyNameConflicts.ts, 13, 26))
}
class StaticLengthFn {
>StaticLengthFn : Symbol(StaticLengthFn, Decl(staticPropertyNameConflicts.ts, 15, 1))
static length() {} // error without useDefineForClassFields
>length : Symbol(StaticLengthFn.length, Decl(staticPropertyNameConflicts.ts, 17, 22))
length() {} // ok
>length : Symbol(StaticLengthFn.length, Decl(staticPropertyNameConflicts.ts, 18, 22))
}
// prototype
class StaticPrototype {
>StaticPrototype : Symbol(StaticPrototype, Decl(staticPropertyNameConflicts.ts, 20, 1))
static prototype: number; // always an error
>prototype : Symbol(StaticPrototype.prototype, Decl(staticPropertyNameConflicts.ts, 23, 23))
prototype: string; // ok
>prototype : Symbol(StaticPrototype.prototype, Decl(staticPropertyNameConflicts.ts, 24, 29))
}
class StaticPrototypeFn {
>StaticPrototypeFn : Symbol(StaticPrototypeFn, Decl(staticPropertyNameConflicts.ts, 26, 1))
static prototype() {} // always an error
>prototype : Symbol(StaticPrototypeFn.prototype, Decl(staticPropertyNameConflicts.ts, 28, 25))
prototype() {} // ok
>prototype : Symbol(StaticPrototypeFn.prototype, Decl(staticPropertyNameConflicts.ts, 29, 25))
}
// caller
class StaticCaller {
>StaticCaller : Symbol(StaticCaller, Decl(staticPropertyNameConflicts.ts, 31, 1))
static caller: number; // error without useDefineForClassFields
>caller : Symbol(StaticCaller.caller, Decl(staticPropertyNameConflicts.ts, 34, 20))
caller: string; // ok
>caller : Symbol(StaticCaller.caller, Decl(staticPropertyNameConflicts.ts, 35, 26))
}
class StaticCallerFn {
>StaticCallerFn : Symbol(StaticCallerFn, Decl(staticPropertyNameConflicts.ts, 37, 1))
static caller() {} // error without useDefineForClassFields
>caller : Symbol(StaticCallerFn.caller, Decl(staticPropertyNameConflicts.ts, 39, 22))
caller() {} // ok
>caller : Symbol(StaticCallerFn.caller, Decl(staticPropertyNameConflicts.ts, 40, 22))
}
// arguments
class StaticArguments {
>StaticArguments : Symbol(StaticArguments, Decl(staticPropertyNameConflicts.ts, 42, 1))
static arguments: number; // error without useDefineForClassFields
>arguments : Symbol(StaticArguments.arguments, Decl(staticPropertyNameConflicts.ts, 45, 23))
arguments: string; // ok
>arguments : Symbol(StaticArguments.arguments, Decl(staticPropertyNameConflicts.ts, 46, 29))
}
class StaticArgumentsFn {
>StaticArgumentsFn : Symbol(StaticArgumentsFn, Decl(staticPropertyNameConflicts.ts, 48, 1))
static arguments() {} // error without useDefineForClassFields
>arguments : Symbol(StaticArgumentsFn.arguments, Decl(staticPropertyNameConflicts.ts, 50, 25))
arguments() {} // ok
>arguments : Symbol(StaticArgumentsFn.arguments, Decl(staticPropertyNameConflicts.ts, 51, 25))
}
// === Static properties on anonymous classes ===
// name
var StaticName_Anonymous = class {
>StaticName_Anonymous : Symbol(StaticName_Anonymous, Decl(staticPropertyNameConflicts.ts, 60, 3))
static name: number; // error without useDefineForClassFields
>name : Symbol(StaticName_Anonymous.name, Decl(staticPropertyNameConflicts.ts, 60, 34))
name: string; // ok
>name : Symbol(StaticName_Anonymous.name, Decl(staticPropertyNameConflicts.ts, 61, 24))
}
var StaticNameFn_Anonymous = class {
>StaticNameFn_Anonymous : Symbol(StaticNameFn_Anonymous, Decl(staticPropertyNameConflicts.ts, 65, 3))
static name() {} // error without useDefineForClassFields
>name : Symbol(StaticNameFn_Anonymous.name, Decl(staticPropertyNameConflicts.ts, 65, 36))
name() {} // ok
>name : Symbol(StaticNameFn_Anonymous.name, Decl(staticPropertyNameConflicts.ts, 66, 20))
}
// length
var StaticLength_Anonymous = class {
>StaticLength_Anonymous : Symbol(StaticLength_Anonymous, Decl(staticPropertyNameConflicts.ts, 71, 3))
static length: number; // error without useDefineForClassFields
>length : Symbol(StaticLength_Anonymous.length, Decl(staticPropertyNameConflicts.ts, 71, 36))
length: string; // ok
>length : Symbol(StaticLength_Anonymous.length, Decl(staticPropertyNameConflicts.ts, 72, 26))
}
var StaticLengthFn_Anonymous = class {
>StaticLengthFn_Anonymous : Symbol(StaticLengthFn_Anonymous, Decl(staticPropertyNameConflicts.ts, 76, 3))
static length() {} // error without useDefineForClassFields
>length : Symbol(StaticLengthFn_Anonymous.length, Decl(staticPropertyNameConflicts.ts, 76, 38))
length() {} // ok
>length : Symbol(StaticLengthFn_Anonymous.length, Decl(staticPropertyNameConflicts.ts, 77, 22))
}
// prototype
var StaticPrototype_Anonymous = class {
>StaticPrototype_Anonymous : Symbol(StaticPrototype_Anonymous, Decl(staticPropertyNameConflicts.ts, 82, 3))
static prototype: number; // always an error
>prototype : Symbol(StaticPrototype_Anonymous.prototype, Decl(staticPropertyNameConflicts.ts, 82, 39))
prototype: string; // ok
>prototype : Symbol(StaticPrototype_Anonymous.prototype, Decl(staticPropertyNameConflicts.ts, 83, 29))
}
var StaticPrototypeFn_Anonymous = class {
>StaticPrototypeFn_Anonymous : Symbol(StaticPrototypeFn_Anonymous, Decl(staticPropertyNameConflicts.ts, 87, 3))
static prototype() {} // always an error
>prototype : Symbol(StaticPrototypeFn_Anonymous.prototype, Decl(staticPropertyNameConflicts.ts, 87, 41))
prototype() {} // ok
>prototype : Symbol(StaticPrototypeFn_Anonymous.prototype, Decl(staticPropertyNameConflicts.ts, 88, 25))
}
// caller
var StaticCaller_Anonymous = class {
>StaticCaller_Anonymous : Symbol(StaticCaller_Anonymous, Decl(staticPropertyNameConflicts.ts, 93, 3))
static caller: number; // error without useDefineForClassFields
>caller : Symbol(StaticCaller_Anonymous.caller, Decl(staticPropertyNameConflicts.ts, 93, 36))
caller: string; // ok
>caller : Symbol(StaticCaller_Anonymous.caller, Decl(staticPropertyNameConflicts.ts, 94, 26))
}
var StaticCallerFn_Anonymous = class {
>StaticCallerFn_Anonymous : Symbol(StaticCallerFn_Anonymous, Decl(staticPropertyNameConflicts.ts, 98, 3))
static caller() {} // error without useDefineForClassFields
>caller : Symbol(StaticCallerFn_Anonymous.caller, Decl(staticPropertyNameConflicts.ts, 98, 38))
caller() {} // ok
>caller : Symbol(StaticCallerFn_Anonymous.caller, Decl(staticPropertyNameConflicts.ts, 99, 22))
}
// arguments
var StaticArguments_Anonymous = class {
>StaticArguments_Anonymous : Symbol(StaticArguments_Anonymous, Decl(staticPropertyNameConflicts.ts, 104, 3))
static arguments: number; // error without useDefineForClassFields
>arguments : Symbol(StaticArguments_Anonymous.arguments, Decl(staticPropertyNameConflicts.ts, 104, 39))
arguments: string; // ok
>arguments : Symbol(StaticArguments_Anonymous.arguments, Decl(staticPropertyNameConflicts.ts, 105, 29))
}
var StaticArgumentsFn_Anonymous = class {
>StaticArgumentsFn_Anonymous : Symbol(StaticArgumentsFn_Anonymous, Decl(staticPropertyNameConflicts.ts, 109, 3))
static arguments() {} // error without useDefineForClassFields
>arguments : Symbol(StaticArgumentsFn_Anonymous.arguments, Decl(staticPropertyNameConflicts.ts, 109, 41))
arguments() {} // ok
>arguments : Symbol(StaticArgumentsFn_Anonymous.arguments, Decl(staticPropertyNameConflicts.ts, 110, 25))
}
// === Static properties on default exported classes ===
// name
module TestOnDefaultExportedClass_1 {
>TestOnDefaultExportedClass_1 : Symbol(TestOnDefaultExportedClass_1, Decl(staticPropertyNameConflicts.ts, 112, 1))
class StaticName {
>StaticName : Symbol(StaticName, Decl(staticPropertyNameConflicts.ts, 118, 37))
static name: number; // error without useDefineForClassFields
>name : Symbol(StaticName.name, Decl(staticPropertyNameConflicts.ts, 119, 22))
name: string; // ok
>name : Symbol(StaticName.name, Decl(staticPropertyNameConflicts.ts, 120, 28))
}
}
module TestOnDefaultExportedClass_2 {
>TestOnDefaultExportedClass_2 : Symbol(TestOnDefaultExportedClass_2, Decl(staticPropertyNameConflicts.ts, 123, 1))
class StaticNameFn {
>StaticNameFn : Symbol(StaticNameFn, Decl(staticPropertyNameConflicts.ts, 125, 37))
static name() {} // error without useDefineForClassFields
>name : Symbol(StaticNameFn.name, Decl(staticPropertyNameConflicts.ts, 126, 24))
name() {} // ok
>name : Symbol(StaticNameFn.name, Decl(staticPropertyNameConflicts.ts, 127, 24))
}
}
// length
module TestOnDefaultExportedClass_3 {
>TestOnDefaultExportedClass_3 : Symbol(TestOnDefaultExportedClass_3, Decl(staticPropertyNameConflicts.ts, 130, 1))
export default class StaticLength {
>StaticLength : Symbol(StaticLength, Decl(staticPropertyNameConflicts.ts, 133, 37))
static length: number; // error without useDefineForClassFields
>length : Symbol(StaticLength.length, Decl(staticPropertyNameConflicts.ts, 134, 39))
length: string; // ok
>length : Symbol(StaticLength.length, Decl(staticPropertyNameConflicts.ts, 135, 30))
}
}
module TestOnDefaultExportedClass_4 {
>TestOnDefaultExportedClass_4 : Symbol(TestOnDefaultExportedClass_4, Decl(staticPropertyNameConflicts.ts, 138, 1))
export default class StaticLengthFn {
>StaticLengthFn : Symbol(StaticLengthFn, Decl(staticPropertyNameConflicts.ts, 140, 37))
static length() {} // error without useDefineForClassFields
>length : Symbol(StaticLengthFn.length, Decl(staticPropertyNameConflicts.ts, 141, 41))
length() {} // ok
>length : Symbol(StaticLengthFn.length, Decl(staticPropertyNameConflicts.ts, 142, 26))
}
}
// prototype
module TestOnDefaultExportedClass_5 {
>TestOnDefaultExportedClass_5 : Symbol(TestOnDefaultExportedClass_5, Decl(staticPropertyNameConflicts.ts, 145, 1))
export default class StaticPrototype {
>StaticPrototype : Symbol(StaticPrototype, Decl(staticPropertyNameConflicts.ts, 148, 37))
static prototype: number; // always an error
>prototype : Symbol(StaticPrototype.prototype, Decl(staticPropertyNameConflicts.ts, 149, 42))
prototype: string; // ok
>prototype : Symbol(StaticPrototype.prototype, Decl(staticPropertyNameConflicts.ts, 150, 33))
}
}
module TestOnDefaultExportedClass_6 {
>TestOnDefaultExportedClass_6 : Symbol(TestOnDefaultExportedClass_6, Decl(staticPropertyNameConflicts.ts, 153, 1))
export default class StaticPrototypeFn {
>StaticPrototypeFn : Symbol(StaticPrototypeFn, Decl(staticPropertyNameConflicts.ts, 155, 37))
static prototype() {} // always an error
>prototype : Symbol(StaticPrototypeFn.prototype, Decl(staticPropertyNameConflicts.ts, 156, 44))
prototype() {} // ok
>prototype : Symbol(StaticPrototypeFn.prototype, Decl(staticPropertyNameConflicts.ts, 157, 29))
}
}
// caller
module TestOnDefaultExportedClass_7 {
>TestOnDefaultExportedClass_7 : Symbol(TestOnDefaultExportedClass_7, Decl(staticPropertyNameConflicts.ts, 160, 1))
export default class StaticCaller {
>StaticCaller : Symbol(StaticCaller, Decl(staticPropertyNameConflicts.ts, 163, 37))
static caller: number; // error without useDefineForClassFields
>caller : Symbol(StaticCaller.caller, Decl(staticPropertyNameConflicts.ts, 164, 39))
caller: string; // ok
>caller : Symbol(StaticCaller.caller, Decl(staticPropertyNameConflicts.ts, 165, 30))
}
}
module TestOnDefaultExportedClass_8 {
>TestOnDefaultExportedClass_8 : Symbol(TestOnDefaultExportedClass_8, Decl(staticPropertyNameConflicts.ts, 168, 1))
export default class StaticCallerFn {
>StaticCallerFn : Symbol(StaticCallerFn, Decl(staticPropertyNameConflicts.ts, 170, 37))
static caller() {} // error without useDefineForClassFields
>caller : Symbol(StaticCallerFn.caller, Decl(staticPropertyNameConflicts.ts, 171, 41))
caller() {} // ok
>caller : Symbol(StaticCallerFn.caller, Decl(staticPropertyNameConflicts.ts, 172, 26))
}
}
// arguments
module TestOnDefaultExportedClass_9 {
>TestOnDefaultExportedClass_9 : Symbol(TestOnDefaultExportedClass_9, Decl(staticPropertyNameConflicts.ts, 175, 1))
export default class StaticArguments {
>StaticArguments : Symbol(StaticArguments, Decl(staticPropertyNameConflicts.ts, 178, 37))
static arguments: number; // error without useDefineForClassFields
>arguments : Symbol(StaticArguments.arguments, Decl(staticPropertyNameConflicts.ts, 179, 42))
arguments: string; // ok
>arguments : Symbol(StaticArguments.arguments, Decl(staticPropertyNameConflicts.ts, 180, 33))
}
}
module TestOnDefaultExportedClass_10 {
>TestOnDefaultExportedClass_10 : Symbol(TestOnDefaultExportedClass_10, Decl(staticPropertyNameConflicts.ts, 183, 1))
export default class StaticArgumentsFn {
>StaticArgumentsFn : Symbol(StaticArgumentsFn, Decl(staticPropertyNameConflicts.ts, 185, 38))
static arguments() {} // error without useDefineForClassFields
>arguments : Symbol(StaticArgumentsFn.arguments, Decl(staticPropertyNameConflicts.ts, 186, 44))
arguments() {} // ok
>arguments : Symbol(StaticArgumentsFn.arguments, Decl(staticPropertyNameConflicts.ts, 187, 29))
}
}

View File

@ -0,0 +1,373 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/staticPropertyNameConflicts.ts ===
// name
class StaticName {
>StaticName : StaticName
static name: number; // error without useDefineForClassFields
>name : number
name: string; // ok
>name : string
}
class StaticNameFn {
>StaticNameFn : StaticNameFn
static name() {} // error without useDefineForClassFields
>name : () => void
name() {} // ok
>name : () => void
}
// length
class StaticLength {
>StaticLength : StaticLength
static length: number; // error without useDefineForClassFields
>length : number
length: string; // ok
>length : string
}
class StaticLengthFn {
>StaticLengthFn : StaticLengthFn
static length() {} // error without useDefineForClassFields
>length : () => void
length() {} // ok
>length : () => void
}
// prototype
class StaticPrototype {
>StaticPrototype : StaticPrototype
static prototype: number; // always an error
>prototype : StaticPrototype
prototype: string; // ok
>prototype : string
}
class StaticPrototypeFn {
>StaticPrototypeFn : StaticPrototypeFn
static prototype() {} // always an error
>prototype : () => void
prototype() {} // ok
>prototype : () => void
}
// caller
class StaticCaller {
>StaticCaller : StaticCaller
static caller: number; // error without useDefineForClassFields
>caller : number
caller: string; // ok
>caller : string
}
class StaticCallerFn {
>StaticCallerFn : StaticCallerFn
static caller() {} // error without useDefineForClassFields
>caller : () => void
caller() {} // ok
>caller : () => void
}
// arguments
class StaticArguments {
>StaticArguments : StaticArguments
static arguments: number; // error without useDefineForClassFields
>arguments : number
arguments: string; // ok
>arguments : string
}
class StaticArgumentsFn {
>StaticArgumentsFn : StaticArgumentsFn
static arguments() {} // error without useDefineForClassFields
>arguments : () => void
arguments() {} // ok
>arguments : () => void
}
// === Static properties on anonymous classes ===
// name
var StaticName_Anonymous = class {
>StaticName_Anonymous : typeof StaticName_Anonymous
>class { static name: number; // error without useDefineForClassFields name: string; // ok} : typeof StaticName_Anonymous
static name: number; // error without useDefineForClassFields
>name : number
name: string; // ok
>name : string
}
var StaticNameFn_Anonymous = class {
>StaticNameFn_Anonymous : typeof StaticNameFn_Anonymous
>class { static name() {} // error without useDefineForClassFields name() {} // ok} : typeof StaticNameFn_Anonymous
static name() {} // error without useDefineForClassFields
>name : () => void
name() {} // ok
>name : () => void
}
// length
var StaticLength_Anonymous = class {
>StaticLength_Anonymous : typeof StaticLength_Anonymous
>class { static length: number; // error without useDefineForClassFields length: string; // ok} : typeof StaticLength_Anonymous
static length: number; // error without useDefineForClassFields
>length : number
length: string; // ok
>length : string
}
var StaticLengthFn_Anonymous = class {
>StaticLengthFn_Anonymous : typeof StaticLengthFn_Anonymous
>class { static length() {} // error without useDefineForClassFields length() {} // ok} : typeof StaticLengthFn_Anonymous
static length() {} // error without useDefineForClassFields
>length : () => void
length() {} // ok
>length : () => void
}
// prototype
var StaticPrototype_Anonymous = class {
>StaticPrototype_Anonymous : typeof StaticPrototype_Anonymous
>class { static prototype: number; // always an error prototype: string; // ok} : typeof StaticPrototype_Anonymous
static prototype: number; // always an error
>prototype : StaticPrototype_Anonymous
prototype: string; // ok
>prototype : string
}
var StaticPrototypeFn_Anonymous = class {
>StaticPrototypeFn_Anonymous : typeof StaticPrototypeFn_Anonymous
>class { static prototype() {} // always an error prototype() {} // ok} : typeof StaticPrototypeFn_Anonymous
static prototype() {} // always an error
>prototype : () => void
prototype() {} // ok
>prototype : () => void
}
// caller
var StaticCaller_Anonymous = class {
>StaticCaller_Anonymous : typeof StaticCaller_Anonymous
>class { static caller: number; // error without useDefineForClassFields caller: string; // ok} : typeof StaticCaller_Anonymous
static caller: number; // error without useDefineForClassFields
>caller : number
caller: string; // ok
>caller : string
}
var StaticCallerFn_Anonymous = class {
>StaticCallerFn_Anonymous : typeof StaticCallerFn_Anonymous
>class { static caller() {} // error without useDefineForClassFields caller() {} // ok} : typeof StaticCallerFn_Anonymous
static caller() {} // error without useDefineForClassFields
>caller : () => void
caller() {} // ok
>caller : () => void
}
// arguments
var StaticArguments_Anonymous = class {
>StaticArguments_Anonymous : typeof StaticArguments_Anonymous
>class { static arguments: number; // error without useDefineForClassFields arguments: string; // ok} : typeof StaticArguments_Anonymous
static arguments: number; // error without useDefineForClassFields
>arguments : number
arguments: string; // ok
>arguments : string
}
var StaticArgumentsFn_Anonymous = class {
>StaticArgumentsFn_Anonymous : typeof StaticArgumentsFn_Anonymous
>class { static arguments() {} // error without useDefineForClassFields arguments() {} // ok} : typeof StaticArgumentsFn_Anonymous
static arguments() {} // error without useDefineForClassFields
>arguments : () => void
arguments() {} // ok
>arguments : () => void
}
// === Static properties on default exported classes ===
// name
module TestOnDefaultExportedClass_1 {
>TestOnDefaultExportedClass_1 : typeof TestOnDefaultExportedClass_1
class StaticName {
>StaticName : StaticName
static name: number; // error without useDefineForClassFields
>name : number
name: string; // ok
>name : string
}
}
module TestOnDefaultExportedClass_2 {
>TestOnDefaultExportedClass_2 : typeof TestOnDefaultExportedClass_2
class StaticNameFn {
>StaticNameFn : StaticNameFn
static name() {} // error without useDefineForClassFields
>name : () => void
name() {} // ok
>name : () => void
}
}
// length
module TestOnDefaultExportedClass_3 {
>TestOnDefaultExportedClass_3 : typeof TestOnDefaultExportedClass_3
export default class StaticLength {
>StaticLength : StaticLength
static length: number; // error without useDefineForClassFields
>length : number
length: string; // ok
>length : string
}
}
module TestOnDefaultExportedClass_4 {
>TestOnDefaultExportedClass_4 : typeof TestOnDefaultExportedClass_4
export default class StaticLengthFn {
>StaticLengthFn : StaticLengthFn
static length() {} // error without useDefineForClassFields
>length : () => void
length() {} // ok
>length : () => void
}
}
// prototype
module TestOnDefaultExportedClass_5 {
>TestOnDefaultExportedClass_5 : typeof TestOnDefaultExportedClass_5
export default class StaticPrototype {
>StaticPrototype : StaticPrototype
static prototype: number; // always an error
>prototype : StaticPrototype
prototype: string; // ok
>prototype : string
}
}
module TestOnDefaultExportedClass_6 {
>TestOnDefaultExportedClass_6 : typeof TestOnDefaultExportedClass_6
export default class StaticPrototypeFn {
>StaticPrototypeFn : StaticPrototypeFn
static prototype() {} // always an error
>prototype : () => void
prototype() {} // ok
>prototype : () => void
}
}
// caller
module TestOnDefaultExportedClass_7 {
>TestOnDefaultExportedClass_7 : typeof TestOnDefaultExportedClass_7
export default class StaticCaller {
>StaticCaller : StaticCaller
static caller: number; // error without useDefineForClassFields
>caller : number
caller: string; // ok
>caller : string
}
}
module TestOnDefaultExportedClass_8 {
>TestOnDefaultExportedClass_8 : typeof TestOnDefaultExportedClass_8
export default class StaticCallerFn {
>StaticCallerFn : StaticCallerFn
static caller() {} // error without useDefineForClassFields
>caller : () => void
caller() {} // ok
>caller : () => void
}
}
// arguments
module TestOnDefaultExportedClass_9 {
>TestOnDefaultExportedClass_9 : typeof TestOnDefaultExportedClass_9
export default class StaticArguments {
>StaticArguments : StaticArguments
static arguments: number; // error without useDefineForClassFields
>arguments : number
arguments: string; // ok
>arguments : string
}
}
module TestOnDefaultExportedClass_10 {
>TestOnDefaultExportedClass_10 : typeof TestOnDefaultExportedClass_10
export default class StaticArgumentsFn {
>StaticArgumentsFn : StaticArgumentsFn
static arguments() {} // error without useDefineForClassFields
>arguments : () => void
arguments() {} // ok
>arguments : () => void
}
}

View File

@ -1,56 +1,58 @@
// @target: es5
// @useDefineForClassFields: true,false
// name
class StaticName {
static name: number; // error
static name: number; // error without useDefineForClassFields
name: string; // ok
}
class StaticNameFn {
static name() {} // error
static name() {} // error without useDefineForClassFields
name() {} // ok
}
// length
class StaticLength {
static length: number; // error
static length: number; // error without useDefineForClassFields
length: string; // ok
}
class StaticLengthFn {
static length() {} // error
static length() {} // error without useDefineForClassFields
length() {} // ok
}
// prototype
class StaticPrototype {
static prototype: number; // error
static prototype: number; // always an error
prototype: string; // ok
}
class StaticPrototypeFn {
static prototype() {} // error
static prototype() {} // always an error
prototype() {} // ok
}
// caller
class StaticCaller {
static caller: number; // error
static caller: number; // error without useDefineForClassFields
caller: string; // ok
}
class StaticCallerFn {
static caller() {} // error
static caller() {} // error without useDefineForClassFields
caller() {} // ok
}
// arguments
class StaticArguments {
static arguments: number; // error
static arguments: number; // error without useDefineForClassFields
arguments: string; // ok
}
class StaticArgumentsFn {
static arguments() {} // error
static arguments() {} // error without useDefineForClassFields
arguments() {} // ok
}
@ -60,56 +62,56 @@ class StaticArgumentsFn {
// name
var StaticName_Anonymous = class {
static name: number; // error
static name: number; // error without useDefineForClassFields
name: string; // ok
}
var StaticNameFn_Anonymous = class {
static name() {} // error
static name() {} // error without useDefineForClassFields
name() {} // ok
}
// length
var StaticLength_Anonymous = class {
static length: number; // error
static length: number; // error without useDefineForClassFields
length: string; // ok
}
var StaticLengthFn_Anonymous = class {
static length() {} // error
static length() {} // error without useDefineForClassFields
length() {} // ok
}
// prototype
var StaticPrototype_Anonymous = class {
static prototype: number; // error
static prototype: number; // always an error
prototype: string; // ok
}
var StaticPrototypeFn_Anonymous = class {
static prototype() {} // error
static prototype() {} // always an error
prototype() {} // ok
}
// caller
var StaticCaller_Anonymous = class {
static caller: number; // error
static caller: number; // error without useDefineForClassFields
caller: string; // ok
}
var StaticCallerFn_Anonymous = class {
static caller() {} // error
static caller() {} // error without useDefineForClassFields
caller() {} // ok
}
// arguments
var StaticArguments_Anonymous = class {
static arguments: number; // error
static arguments: number; // error without useDefineForClassFields
arguments: string; // ok
}
var StaticArgumentsFn_Anonymous = class {
static arguments() {} // error
static arguments() {} // error without useDefineForClassFields
arguments() {} // ok
}
@ -119,14 +121,14 @@ var StaticArgumentsFn_Anonymous = class {
// name
module TestOnDefaultExportedClass_1 {
class StaticName {
static name: number; // error
static name: number; // error without useDefineForClassFields
name: string; // ok
}
}
module TestOnDefaultExportedClass_2 {
class StaticNameFn {
static name() {} // error
static name() {} // error without useDefineForClassFields
name() {} // ok
}
}
@ -134,29 +136,29 @@ module TestOnDefaultExportedClass_2 {
// length
module TestOnDefaultExportedClass_3 {
export default class StaticLength {
static length: number; // error
static length: number; // error without useDefineForClassFields
length: string; // ok
}
}
module TestOnDefaultExportedClass_4 {
export default class StaticLengthFn {
static length() {} // error
static length() {} // error without useDefineForClassFields
length() {} // ok
}
}
// prototype
module TestOnDefaultExportedClass_5 {
module TestOnDefaultExportedClass_5 {
export default class StaticPrototype {
static prototype: number; // error
static prototype: number; // always an error
prototype: string; // ok
}
}
module TestOnDefaultExportedClass_6 {
export default class StaticPrototypeFn {
static prototype() {} // error
static prototype() {} // always an error
prototype() {} // ok
}
}
@ -164,14 +166,14 @@ module TestOnDefaultExportedClass_6 {
// caller
module TestOnDefaultExportedClass_7 {
export default class StaticCaller {
static caller: number; // error
static caller: number; // error without useDefineForClassFields
caller: string; // ok
}
}
module TestOnDefaultExportedClass_8 {
export default class StaticCallerFn {
static caller() {} // error
static caller() {} // error without useDefineForClassFields
caller() {} // ok
}
}
@ -179,14 +181,14 @@ module TestOnDefaultExportedClass_8 {
// arguments
module TestOnDefaultExportedClass_9 {
export default class StaticArguments {
static arguments: number; // error
static arguments: number; // error without useDefineForClassFields
arguments: string; // ok
}
}
module TestOnDefaultExportedClass_10 {
export default class StaticArgumentsFn {
static arguments() {} // error
static arguments() {} // error without useDefineForClassFields
arguments() {} // ok
}
}
}