There was an error while loading. Please reload this page.
1 parent bc946ba commit 0d8f63eCopy full SHA for 0d8f63e
src/lib/generate-comments.ts
@@ -10,5 +10,7 @@ export const generateComments = (opts: {
10
if (opts.method) comments.push(` * @method ${opts.method.toUpperCase()}`);
11
if (opts.deprecated) comments.push('* @deprecated');
12
13
- return comments.length ? `\n/**\n${comments.join('\n')}\n*/\n` : '';
+ return comments.length
14
+ ? `\n/**\n${comments.join('\n').replaceAll('*/', '*\\/')}\n*/\n`
15
+ : '';
16
};
test/lib/generate-comment.test.ts
@@ -64,3 +64,14 @@ test('method', () => {
64
"
65
`);
66
});
67
+
68
+test('避免文档注释提前结束', () => {
69
+ expect(generateComments({ description: 'foo */ **/ / *\/ bar' }))
70
+ .toMatchInlineSnapshot(`
71
+ "
72
+ /**
73
+ * foo *\\/ **\\/ / *\\/ bar
74
+ */
75
76
+ `);
77
+});
0 commit comments