(sourceFile: ts.SourceFile)
| 3222 | } |
| 3223 | |
| 3224 | function sourceFileTopLevelJSDoc(sourceFile: ts.SourceFile): ParsedModuleJSDoc | undefined { |
| 3225 | const source = sourceFile.text |
| 3226 | const start = skipLeadingIgnoredTrivia(source) |
| 3227 | if (!source.startsWith("/**", start)) return undefined |
| 3228 | const end = source.indexOf("*/", start + 3) |
| 3229 | if (end === -1) return undefined |
| 3230 | const range = [start, end + 2] as const |
| 3231 | const firstStatement = sourceFile.statements[0] |
| 3232 | if (firstStatement !== undefined) { |
| 3233 | const jsDocs = (firstStatement as { readonly jsDoc?: ReadonlyArray<ts.JSDoc> }).jsDoc ?? [] |
| 3234 | if ( |
| 3235 | jsDocs.some((jsDoc) => jsDoc.pos === range[0] && jsDoc.end === range[1]) && |
| 3236 | !ts.isImportDeclaration(firstStatement) && |
| 3237 | !ts.isImportEqualsDeclaration(firstStatement) |
| 3238 | ) return undefined |
| 3239 | } |
| 3240 | return { raw: source.slice(range[0], range[1]), range } |
| 3241 | } |
| 3242 | |
| 3243 | function parseModuleJSDocTs( |
| 3244 | sourceFile: ts.SourceFile, |
no test coverage detected