Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addJsDocComment: enabling the trailing new line option #15

Merged
merged 2 commits into from
Jun 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}"
`)
})