From 16c20606477246a6f6907c71286d164ce18a374a Mon Sep 17 00:00:00 2001 From: Yam C Borodetsky Date: Fri, 17 Oct 2025 15:18:45 +0300 Subject: [PATCH 1/2] fix: ensure localStorage.getItem is a function before calling it in shouldDebug --- packages/typescript-vfs/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-vfs/src/index.ts b/packages/typescript-vfs/src/index.ts index be88ea840ac8..11f0c0e2e43c 100755 --- a/packages/typescript-vfs/src/index.ts +++ b/packages/typescript-vfs/src/index.ts @@ -23,7 +23,7 @@ try { } catch (error) { } const hasProcess = typeof process !== `undefined` -const shouldDebug = (hasLocalStorage && localStorage!.getItem("DEBUG")) || (hasProcess && process.env.DEBUG) +const shouldDebug = (hasLocalStorage && typeof localStorage!.getItem === 'function' && localStorage!.getItem("DEBUG")) || (hasProcess && process.env.DEBUG) const debugLog = shouldDebug ? console.log : (_message?: any, ..._optionalParams: any[]) => "" export interface VirtualTypeScriptEnvironment { From c1e17bf70063052fcc7fa550209cb90a03eda220 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 20 Oct 2025 11:02:31 -0700 Subject: [PATCH 2/2] Changeset --- .changeset/famous-pillows-kiss.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/famous-pillows-kiss.md diff --git a/.changeset/famous-pillows-kiss.md b/.changeset/famous-pillows-kiss.md new file mode 100644 index 000000000000..97f384436aad --- /dev/null +++ b/.changeset/famous-pillows-kiss.md @@ -0,0 +1,5 @@ +--- +"@typescript/vfs": patch +--- + +Modify localStorage check to prevent crashes in Node 25