Skip to content

Commit 74986a6

Browse files
author
Joseph Watts
committed
Fix private name transformation clash with constructor overload list
Signed-off-by: Joseph Watts <[email protected]>
1 parent dd7c993 commit 74986a6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/compiler/transformers/esnext.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,14 @@ namespace ts {
228228
)
229229
);
230230
});
231-
const ctor = find(members, (member) => isConstructorDeclaration(member)) as ConstructorDeclaration | undefined;
231+
const ctor = find(
232+
members,
233+
(member) => isConstructorDeclaration(member) && !!member.body
234+
) as ConstructorDeclaration | undefined;
232235
if (ctor) {
233-
const body = ctor.body ?
234-
updateBlock(ctor.body, [...initializerStatements, ...ctor.body.statements]) :
235-
createBlock(initializerStatements, /* multiLine */ undefined);
236+
const body = updateBlock(ctor.body!, [...initializerStatements, ...ctor.body!.statements]);
236237
return members.map(member => {
237-
if (isConstructorDeclaration(member)) {
238+
if (member === ctor) {
238239
return updateConstructor(
239240
ctor,
240241
ctor.decorators,

0 commit comments

Comments
 (0)