Skip to content

Commit 24ad88c

Browse files
author
Joseph Watts
committed
Remove private named property declaration initializer in TS transform
1 parent c9cb7fe commit 24ad88c

File tree

1 file changed

+10
-2
lines changed
  • src/compiler/transformers

1 file changed

+10
-2
lines changed

src/compiler/transformers/ts.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2239,8 +2239,16 @@ namespace ts {
22392239

22402240
function visitPropertyDeclaration(node: PropertyDeclaration): PropertyDeclaration | undefined {
22412241
if (isPrivateName(node.name)) {
2242-
// Keep the private name declaration.
2243-
return node;
2242+
// Keep the private name declaration (without the initializer - which will be moved to the constructor).
2243+
return updateProperty(
2244+
node,
2245+
node.decorators,
2246+
node.modifiers,
2247+
node.name,
2248+
node.questionToken,
2249+
node.type,
2250+
/*initializer*/ undefined
2251+
);
22442252
}
22452253
const expr = getPropertyNameExpressionIfNeeded(node.name, some(node.decorators) || !!node.initializer, /*omitSimple*/ true);
22462254
if (expr && !isSimpleInlineableExpression(expr)) {

0 commit comments

Comments
 (0)