Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 97342cc

Browse files
committed
Add warning for missing file content read
1 parent 5cac90f commit 97342cc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/memfs.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,12 @@ export class InMemoryFileSystem extends EventEmitter implements ts.ParseConfigHo
141141
* If there is no such file, returns empty string to match expected signature
142142
*/
143143
readFile(path: string): string {
144-
return this.readFileIfExists(path) || '';
144+
const content = this.readFileIfExists(path);
145+
if (content === undefined) {
146+
this.logger.warn(`readFile ${path} requested by TypeScript but content not available`);
147+
return '';
148+
}
149+
return content;
145150
}
146151

147152
/**

0 commit comments

Comments
 (0)