@@ -3229,8 +3229,7 @@ namespace ts {
3229
3229
// A ClassDeclaration is ES6 syntax.
3230
3230
transformFlags = subtreeFlags | TransformFlags . AssertES2015 ;
3231
3231
3232
- // A class with a parameter property assignment, property initializer, computed property name, or decorator is
3233
- // TypeScript syntax.
3232
+ // A class with a parameter property assignment or decorator is TypeScript syntax.
3234
3233
// An exported declaration may be TypeScript syntax, but is handled by the visitor
3235
3234
// for a namespace declaration.
3236
3235
if ( ( subtreeFlags & TransformFlags . ContainsTypeScriptClassSyntax )
@@ -3247,8 +3246,7 @@ namespace ts {
3247
3246
// A ClassExpression is ES6 syntax.
3248
3247
let transformFlags = subtreeFlags | TransformFlags . AssertES2015 ;
3249
3248
3250
- // A class with a parameter property assignment, property initializer, or decorator is
3251
- // TypeScript syntax.
3249
+ // A class with a parameter property assignment or decorator is TypeScript syntax.
3252
3250
if ( subtreeFlags & TransformFlags . ContainsTypeScriptClassSyntax
3253
3251
|| node . typeParameters ) {
3254
3252
transformFlags |= TransformFlags . AssertTypeScript ;
@@ -3338,7 +3336,6 @@ namespace ts {
3338
3336
|| hasModifier ( node , ModifierFlags . TypeScriptModifier )
3339
3337
|| node . typeParameters
3340
3338
|| node . type
3341
- || ( node . name && isComputedPropertyName ( node . name ) ) // While computed method names aren't typescript, the TS transform must visit them to emit property declarations correctly
3342
3339
|| ! node . body ) {
3343
3340
transformFlags |= TransformFlags . AssertTypeScript ;
3344
3341
}
@@ -3369,7 +3366,6 @@ namespace ts {
3369
3366
if ( node . decorators
3370
3367
|| hasModifier ( node , ModifierFlags . TypeScriptModifier )
3371
3368
|| node . type
3372
- || ( node . name && isComputedPropertyName ( node . name ) ) // While computed accessor names aren't typescript, the TS transform must visit them to emit property declarations correctly
3373
3369
|| ! node . body ) {
3374
3370
transformFlags |= TransformFlags . AssertTypeScript ;
3375
3371
}
@@ -3384,12 +3380,15 @@ namespace ts {
3384
3380
}
3385
3381
3386
3382
function computePropertyDeclaration ( node : PropertyDeclaration , subtreeFlags : TransformFlags ) {
3387
- // A PropertyDeclaration is TypeScript syntax.
3388
- let transformFlags = subtreeFlags | TransformFlags . AssertTypeScript ;
3383
+ let transformFlags = subtreeFlags | TransformFlags . ContainsClassFields ;
3384
+
3385
+ // Decorators, TypeScript-specific modifiers, and type annotations are TypeScript syntax.
3386
+ if ( some ( node . decorators ) || hasModifier ( node , ModifierFlags . TypeScriptModifier ) || node . type ) {
3387
+ transformFlags |= TransformFlags . AssertTypeScript ;
3388
+ }
3389
3389
3390
- // If the PropertyDeclaration has an initializer or a computed name, we need to inform its ancestor
3391
- // so that it handle the transformation.
3392
- if ( node . initializer || isComputedPropertyName ( node . name ) ) {
3390
+ // Hoisted variables related to class properties should live within the TypeScript class wrapper.
3391
+ if ( isComputedPropertyName ( node . name ) || ( hasStaticModifier ( node ) && node . initializer ) ) {
3393
3392
transformFlags |= TransformFlags . ContainsTypeScriptClassSyntax ;
3394
3393
}
3395
3394
0 commit comments