(node: T, source: ts.Node, additionalTags: string[])
| 100 | } |
| 101 | |
| 102 | function cloneJsDoc<T extends ts.Node>(node: T, source: ts.Node, additionalTags: string[]): T { |
| 103 | const docs = ts |
| 104 | .getJSDocCommentsAndTags(source) |
| 105 | .filter(s => ts.isJSDoc(s)) |
| 106 | .map(s => s.getText()) as string[]; |
| 107 | |
| 108 | for (let text of docs) { |
| 109 | if (text.startsWith('/**')) { |
| 110 | text = text |
| 111 | .substring(2, text.length - 2) |
| 112 | .split('\n') |
| 113 | .map(l => ` ${l.trimStart()}`) |
| 114 | .join('\n') |
| 115 | .trimStart(); |
| 116 | |
| 117 | for (const tag of additionalTags) { |
| 118 | if (!text.includes(tag)) { |
| 119 | text += `* ${tag}\n `; |
| 120 | } |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | node = ts.addSyntheticLeadingComment(node, ts.SyntaxKind.MultiLineCommentTrivia, text, true); |
| 125 | } |
| 126 | |
| 127 | return node; |
| 128 | } |
| 129 | |
| 130 | function createJsonMember( |
| 131 | program: ts.Program, |
no test coverage detected