diff --git a/lib/react/src/jsx-runtime/_internal.ts b/lib/react/src/jsx-runtime/_internal.ts index 39b7830..e3f7f9f 100644 --- a/lib/react/src/jsx-runtime/_internal.ts +++ b/lib/react/src/jsx-runtime/_internal.ts @@ -1,11 +1,11 @@ -import type { ElementType } from 'react' +import type { ElementType, JSX } from 'react' import type { AfterJSXCallback, BeforeJSXCallback, InsteadJSXCallback } from '.' export const jPatches = new Map< - ElementType | string, + ElementType | keyof JSX.IntrinsicElements, [ - before?: Set, - after?: Set, - instead?: Set, + before?: Set>, + after?: Set>, + instead?: Set>, ] >() diff --git a/lib/react/src/jsx-runtime/index.ts b/lib/react/src/jsx-runtime/index.ts index e3c78da..de3f874 100644 --- a/lib/react/src/jsx-runtime/index.ts +++ b/lib/react/src/jsx-runtime/index.ts @@ -1,5 +1,5 @@ import { jPatches } from './_internal' -import type { ElementType, Key, ReactElement } from 'react' +import type { ElementType, JSX, Key, ReactElement } from 'react' import type { ReactJSXRuntime } from '..' export type AnyJSXFactoryFunction = (typeof ReactJSXRuntime)['jsx' | 'jsxs'] @@ -21,7 +21,9 @@ type ElementTypeProps = E extends ElementType< infer Props > ? Props - : never + : E extends keyof JSX.IntrinsicElements + ? JSX.IntrinsicElements[E] + : never /** * Registers a hook to be called after a JSX element with the specified type is created.