2484210a00
* If target:esnext,then useDefineForClassFields: true will now be the default. * Added error if a private identifier is used in a static a initializer if target:ESNext and useDefineForClassFields:false. * Added test for new useDefineForClassFields default and error message. * Fixed tests after changing the default of useDefineForClassFields to true for target esnext * Fixed code review suggestions. * Updated error message. * Added missing static check for the containing property. Fixed other code review issues.
11 lines
393 B
Plaintext
11 lines
393 B
Plaintext
=== tests/cases/compiler/useDefineForClassFieldsFlagDefault.ts ===
|
|
class Foo {
|
|
>Foo : Foo
|
|
|
|
// For esNext should be emitted 'as is' because useDefineForClassFields defaults to true
|
|
// For es2020 should be emitted as an assignment after the class definition (not Object.defineProperty) because useDefineForClassFields defaults to false
|
|
static x = 1;
|
|
>x : number
|
|
>1 : 1
|
|
}
|