Skip to content

Commit 3d11da6

Browse files
committed
fix: improve browser environment detection in InMemoryDriver to enhance reliability
1 parent 0e93f66 commit 3d11da6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/plugins/driver-memory/src/memory-driver.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,9 +1086,10 @@ export class InMemoryDriver implements IDataDriver {
10861086
* false positives in Node.js runtimes that partially polyfill globals.
10871087
*/
10881088
private isBrowserEnvironment(): boolean {
1089-
return typeof globalThis.window !== 'undefined'
1090-
&& typeof globalThis.document !== 'undefined'
1091-
&& typeof globalThis.localStorage?.setItem === 'function';
1089+
const g = globalThis as any;
1090+
return typeof g.window !== 'undefined'
1091+
&& typeof g.document !== 'undefined'
1092+
&& typeof g.localStorage?.setItem === 'function';
10921093
}
10931094

10941095
/**

0 commit comments

Comments
 (0)