From 4f31ca9a91e307f1b77d0db445889ac59a641a83 Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Tue, 10 Jun 2025 22:15:19 +0700 Subject: [PATCH] fix(shims/react~jsx-runtime): dedupe unproxy code --- shims/react~jsx-runtime.ts | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/shims/react~jsx-runtime.ts b/shims/react~jsx-runtime.ts index b807092..624c502 100644 --- a/shims/react~jsx-runtime.ts +++ b/shims/react~jsx-runtime.ts @@ -5,18 +5,16 @@ import type { ElementType } from 'react' const { jsx: _jsx, jsxs: _jsxs, Fragment } = ReactJsxRuntime const jsx = ((type, ...args) => - _jsx( - isProxified(type as object) - ? (unproxify(type as object) as ElementType) - : type, - ...args, - )) as typeof _jsx -const jsxs = ((type, ...args) => - _jsxs( - isProxified(type as object) - ? (unproxify(type as object) as ElementType) - : type, - ...args, - )) as typeof _jsxs + _jsx(unproxy(type as object), ...args)) as typeof _jsx + +const jsxs = ((type, ...args) => { + return _jsxs(unproxy(type as object), ...args) +}) as typeof _jsxs + +function unproxy(type: object): ElementType { + return (isProxified(type) + ? unproxify(type) + : type) as unknown as ElementType +} module.exports = { jsx, jsxs, Fragment }