From 0d1fcb5c2dd52accc3f8266a352377a25cb3e629 Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Mon, 4 Aug 2025 09:36:11 +0700 Subject: [PATCH] feat(lib/utils/proxy)!: return non-proxified value if passed to `unproxify` --- lib/utils/src/proxy.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/utils/src/proxy.ts b/lib/utils/src/proxy.ts index 41bccd3..89f734d 100644 --- a/lib/utils/src/proxy.ts +++ b/lib/utils/src/proxy.ts @@ -152,13 +152,12 @@ export function proxify(signal: () => T, options?: ProxifyOptions): T { /** * Get the value of a proxified value at the current moment. + * Returns the same value if not a proxified value. * * @see {@link proxify} for more documentation. * * @param proxified The proxified value. - * @returns The unproxified value. - * - * @throws {TypeError} If the value is not a proxified value. + * @returns The unproxified value, or the value if it's not a proxified value. * * @example Without cache * ```ts @@ -180,8 +179,7 @@ export function proxify(signal: () => T, options?: ProxifyOptions): T { */ export function unproxify(proxified: T): T { const hint = getProxyTarget(proxified) - if (!hint) - throw new TypeError(`${typeof proxified} is not a proxified value`) + if (!hint) return proxified return unproxifyFromHint(hint) }