Skip to content

Commit 681138b

Browse files
fix: fixed constructor covert
1 parent 91ea5d8 commit 681138b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

typescript/type-converter.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,17 @@ module.exports = function typeConverter(src, filename = 'test.ts') {
268268
if (ts.isFunctionLike(member)) {
269269
memberComment = fillMethodComment(memberComment, member, src)
270270
}
271-
if (modifiers.find((m => m === 'static'))) {
272-
memberComment += '\n' + `${className}.${getName(member, src)}`
271+
if (ts.isConstructorDeclaration(member)) {
272+
memberComment = appendComment(memberComment, `@constructor`)
273+
memberComment += `\n${className}.prototype.${className}`
273274
} else {
274-
memberComment += '\n' + `${className}.prototype.${getName(member, src)}`
275+
if (modifiers.find((m) => m === "static")) {
276+
memberComment += `\n${className}.${getName(member, src)}`
277+
} else {
278+
memberComment += `\n${className}.prototype.${getName(member, src)}`
279+
}
275280
}
276-
comment += '\n' + memberComment
281+
comment += "\n" + memberComment
277282
})
278283
return comment
279284
}

0 commit comments

Comments
 (0)