Skip to content

Commit

Permalink
addJsDocComment: enabling the trailing new line option (#15)
Browse files Browse the repository at this point in the history
* addJsDocComment: enabling the trailing new line option

* Updating the snapshots.
  • Loading branch information
RobinTail authored Jun 12, 2022
1 parent a3cee7a commit 593bf3e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ export const getIdentifierOrStringLiteral = (str: string) => {
}

export const addJsDocComment = (node: ts.Node, text: string) => {
ts.addSyntheticLeadingComment(node, ts.SyntaxKind.MultiLineCommentTrivia, `* ${text} `)
ts.addSyntheticLeadingComment(node, ts.SyntaxKind.MultiLineCommentTrivia, `* ${text} `, true)
}
3 changes: 2 additions & 1 deletion test/create-type-alias.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ describe('type alias', () => {
)

expect(printNodeTest(typeAlias)).toMatchInlineSnapshot(`
"/** A basic user */ type User = {
"/** A basic user */
type User = {
username: string;
age: number;
};"
Expand Down
6 changes: 4 additions & 2 deletions test/object.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ it('supports zod.describe()', () => {

expect(printNodeTest(node)).toMatchInlineSnapshot(`
"{
/** The name of the item */ name: string;
/** The price of the item */ price: number;
/** The name of the item */
name: string;
/** The price of the item */
price: number;
}"
`)
})

0 comments on commit 593bf3e

Please sign in to comment.