fix(shims/react~jsx-runtime): dedupe unproxy code

This commit is contained in:
PalmDevs 2025-06-10 22:15:19 +07:00
parent 38d5aa3833
commit 4f31ca9a91
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA

View file

@ -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 }