From e39ad598d90545b47e5e9c86a786b2b838edcaa3 Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Thu, 10 Apr 2025 00:55:58 +0700 Subject: [PATCH] fix(lib/utils/proxy): cleanup `destructure` --- lib/utils/src/proxy.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/utils/src/proxy.ts b/lib/utils/src/proxy.ts index b645a7a..761061e 100644 --- a/lib/utils/src/proxy.ts +++ b/lib/utils/src/proxy.ts @@ -169,10 +169,9 @@ export function destructure(proxified: T, options?: ProxifyOpt const v = unproxify(proxified)[p] if (v == null) throw new TypeError(`Cannot destructure and proxify ${v} (reading '${String(p)}')`) + if (typeof v === 'function' || typeof v === 'object') return v // Forcefully proxify primitives - if (typeof v !== 'object' && typeof v !== 'function') return Object(v) - - return v + return Object(v) }, options), }) }