From 83b9400479af8c615455dca321f9c576ba1de3b6 Mon Sep 17 00:00:00 2001 From: Anshuman Pandey <54475686+pandeymangg@users.noreply.github.com> Date: Thu, 18 Apr 2024 21:36:22 +0530 Subject: [PATCH] fix: structured clone (#2483) --- packages/lib/pollyfills/structuredClone.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/lib/pollyfills/structuredClone.ts b/packages/lib/pollyfills/structuredClone.ts index b05fc36e42..c8aac80307 100644 --- a/packages/lib/pollyfills/structuredClone.ts +++ b/packages/lib/pollyfills/structuredClone.ts @@ -1,11 +1,12 @@ import structuredClonePolyfill from "@ungap/structured-clone"; -let structuredCloneExport = structuredClone; +let structuredCloneExport: typeof structuredClonePolyfill; -if (typeof structuredCloneExport === "undefined") { - // @ts-expect-error +if (typeof structuredClone === "undefined") { structuredCloneExport = structuredClonePolyfill; +} else { + // @ts-expect-error + structuredCloneExport = structuredClone; } -// export default structuredCloneExport; export { structuredCloneExport as structuredClone };