(sourceFile: ts.SourceFile)
| 3292 | } |
| 3293 | |
| 3294 | function sourceFileTopLevelJSDoc(sourceFile: ts.SourceFile): ParsedModuleJSDoc | undefined { |
| 3295 | const source = sourceFile.text |
| 3296 | const start = skipLeadingIgnoredTrivia(source) |
| 3297 | if (!source.startsWith("/**", start)) return undefined |
| 3298 | const end = source.indexOf("*/", start + 3) |
| 3299 | if (end === -1) return undefined |
| 3300 | const range = [start, end + 2] as const |
| 3301 | const firstStatement = sourceFile.statements[0] |
| 3302 | if (firstStatement !== undefined) { |
| 3303 | const jsDocs = (firstStatement as { readonly jsDoc?: ReadonlyArray<ts.JSDoc> }).jsDoc ?? [] |
| 3304 | if ( |
| 3305 | jsDocs.some((jsDoc) => jsDoc.pos === range[0] && jsDoc.end === range[1]) && |
| 3306 | !ts.isImportDeclaration(firstStatement) && |
| 3307 | !ts.isImportEqualsDeclaration(firstStatement) |
| 3308 | ) return undefined |
| 3309 | } |
| 3310 | return { raw: source.slice(range[0], range[1]), range } |
| 3311 | } |
| 3312 | |
| 3313 | function parseModuleJSDocTs( |
| 3314 | sourceFile: ts.SourceFile, |
no test coverage detected