From 9ff2b8f0f65ff05558b03bf00811c2c96b7b099b Mon Sep 17 00:00:00 2001 From: Morgan Zolob Date: Tue, 20 May 2025 17:34:56 -0700 Subject: [PATCH] fix: handle undefined paths in getModifiedTime When building projects in `tsc` build mode (with `typescript.build` set to `true`), some paths passed to `getModifiedTime` will be `undefined`. Previously, this would cause an error and prevent type-checking (see https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/855). With these changes, the modified time will just be returned as `undefined` in such cases, which allows type checking to complete successfully. --- src/typescript/worker/lib/system.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/typescript/worker/lib/system.ts b/src/typescript/worker/lib/system.ts index 65f85122..8138fd12 100644 --- a/src/typescript/worker/lib/system.ts +++ b/src/typescript/worker/lib/system.ts @@ -114,6 +114,10 @@ export const system: ControlledTypeScriptSystem = { .map((dirent) => dirent.name); }, getModifiedTime(path: string): Date | undefined { + if (typeof path !== "string") { + return undefined; + } + const stats = getReadFileSystem(path).readStats(path); if (stats) {