Skip to content

Commit

Permalink
remove undefined comment (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
kahirokunn committed Dec 25, 2020
1 parent d1d40d2 commit 5e838a0
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions src/generate.ts
Expand Up @@ -389,23 +389,27 @@ export async function generateApi(
),
undefined,
factory.createTypeLiteralNode(
Object.entries(queryArg).map(([name, def]) =>
ts.addSyntheticLeadingComment(
factory.createPropertySignature(
undefined,
name,
createQuestionToken(!def.required),
def.type
),
ts.SyntaxKind.MultiLineCommentTrivia,
`* ${
def.origin === "param"
? def.param.description
: def.body.description
} `,
true
Object.entries(queryArg).map(([name, def]) => {
const comment = def.origin === "param"
? def.param.description
: def.body.description;
const node = factory.createPropertySignature(
undefined,
name,
createQuestionToken(!def.required),
def.type
)
)

if (comment) {
return ts.addSyntheticLeadingComment(
node,
ts.SyntaxKind.MultiLineCommentTrivia,
`* ${comment} `,
true
)
}
return node
})
)
)
).name
Expand Down

0 comments on commit 5e838a0

Please sign in to comment.