Skip to content

Commit 90e66c7

Browse files
authored
feat(dts-generator): support optional fields (class properties) (#497)
1 parent c9dce32 commit 90e66c7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/dts-generator/src/phases/dts-code-gen.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,8 @@ function genField(ast: Variable) {
632632
text += ast.static ? "static " : "";
633633
text += ast.readonly ? "readonly " : "";
634634
text +=
635-
`${ast.name} : ${ast.type ? genType(ast.type, "property") : "any"}` + NL;
635+
`${ast.name}${ast.optional ? "?" : ""} : ${ast.type ? genType(ast.type, "property") : "any"}` +
636+
NL;
636637
return text;
637638
}
638639

0 commit comments

Comments
 (0)