Skip to content

Commit 488da14

Browse files
committed
JS: Don't try to augment invalid files
This check existed on the code path for full type extraction, but not for plain single-file extraction.
1 parent 74b817b commit 488da14

File tree

1 file changed

+3
-1
lines changed
  • javascript/extractor/lib/typescript/src

1 file changed

+3
-1
lines changed

javascript/extractor/lib/typescript/src/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,9 @@ function isExtractableSourceFile(ast: ast_extractor.AugmentedSourceFile): boolea
372372
*/
373373
function getAstForFile(filename: string): ts.SourceFile {
374374
let { ast, code } = parseSingleFile(filename);
375-
ast_extractor.augmentAst(ast, code, null);
375+
if (ast != null && isExtractableSourceFile(ast)) {
376+
ast_extractor.augmentAst(ast, code, null);
377+
}
376378
return ast;
377379
}
378380

0 commit comments

Comments
 (0)