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.
This commit is contained in:
Asger F
2025-06-24 17:46:30 +02:00
parent 74b817b642
commit 488da145e8

View File

@@ -372,7 +372,9 @@ function isExtractableSourceFile(ast: ast_extractor.AugmentedSourceFile): boolea
*/
function getAstForFile(filename: string): ts.SourceFile {
let { ast, code } = parseSingleFile(filename);
ast_extractor.augmentAst(ast, code, null);
if (ast != null && isExtractableSourceFile(ast)) {
ast_extractor.augmentAst(ast, code, null);
}
return ast;
}