Skip to content

Commit

Permalink
Fix fallback path (#291)
Browse files Browse the repository at this point in the history
The `generateDtsFromTs` path expects cases where `!module.source` but since #249 `getModule` does not actually return it as it fails trying to use it for gathering `code`.
  • Loading branch information
cschramm committed Sep 15, 2023
1 parent 1bc6317 commit f60a27e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function getModule(
// we know this exists b/c of the .filter above, so this non-null assertion is safe
const source = existingProgram.getSourceFile(fileName)!;
return {
code: source.getFullText(),
code: source?.getFullText(),
source,
program: existingProgram,
};
Expand All @@ -51,7 +51,7 @@ function getModule(
// we created hte program from this fileName, so the source file must exist :P
const source = newProgram.getSourceFile(fileName)!;
return {
code: source.getFullText(),
code: source?.getFullText(),
source,
program: newProgram,
};
Expand Down

0 comments on commit f60a27e

Please sign in to comment.