diff --git a/packages/solid/store/src/server.ts b/packages/solid/store/src/server.ts index 8cfa6823d..cdd7bd2df 100644 --- a/packages/solid/store/src/server.ts +++ b/packages/solid/store/src/server.ts @@ -6,7 +6,7 @@ export function isWrappable(obj: any) { return ( obj != null && typeof obj === "object" && - (obj.__proto__ === Object.prototype || Array.isArray(obj)) + (Object.getPrototypeOf(obj) === Object.prototype || Array.isArray(obj)) ); } diff --git a/packages/solid/store/src/store.ts b/packages/solid/store/src/store.ts index 3145a74a7..887973f1e 100644 --- a/packages/solid/store/src/store.ts +++ b/packages/solid/store/src/store.ts @@ -41,10 +41,14 @@ function wrap(value: T, name?: string): T { export function isWrappable(obj: T | NotWrappable): obj is T; export function isWrappable(obj: any) { + let proto; return ( obj != null && typeof obj === "object" && - (obj[$PROXY] || !obj.__proto__ || obj.__proto__ === Object.prototype || Array.isArray(obj)) + (obj[$PROXY] || + !(proto = Object.getPrototypeOf(obj)) || + proto === Object.prototype || + Array.isArray(obj)) ); }