@@ -108,6 +108,22 @@ Yields:
108108<h1 >Hello, world!</h1 >
109109```
110110
111+ > ** Note** :
112+ > To add proper type support in React\@ 19,
113+ > register a global JSX namespace:
114+ >
115+ > ``` ts
116+ > import type {JSX as Jsx } from ' react/jsx-runtime'
117+ >
118+ > declare global {
119+ > namespace JSX {
120+ > type ElementClass = Jsx .ElementClass
121+ > type Element = Jsx .Element
122+ > type IntrinsicElements = Jsx .IntrinsicElements
123+ > }
124+ > }
125+ > ` ` `
126+
111127## API
112128
113129This package exports the identifier [ ` toJsxRuntime ` ][api-to-jsx-runtime].
@@ -517,6 +533,21 @@ render(
517533)
518534```
519535
536+ To add proper type support,
537+ register a global JSX namespace:
538+
539+ ``` ts
540+ import type {JSX as Jsx } from ' preact/jsx-runtime'
541+
542+ declare global {
543+ namespace JSX {
544+ type ElementClass = Jsx .ElementClass
545+ type Element = Jsx .Element
546+ type IntrinsicElements = Jsx .IntrinsicElements
547+ }
548+ }
549+ ```
550+
520551### Example: Solid
521552
522553> 👉 ** Note** : you must set ` elementAttributeNameCase: 'html' ` and
@@ -567,6 +598,21 @@ function Component() {
567598}
568599```
569600
601+ To add proper type support,
602+ register a global JSX namespace:
603+
604+ ``` ts
605+ import type {JSX as Jsx } from ' solid-js/jsx-runtime'
606+
607+ declare global {
608+ namespace JSX {
609+ type ElementClass = Jsx .ElementClass
610+ type Element = Jsx .Element
611+ type IntrinsicElements = Jsx .IntrinsicElements
612+ }
613+ }
614+ ```
615+
570616### Example: Svelte
571617
572618<!-- To do: improve svelte when it fixes a bunch of bugs. -->
@@ -590,6 +636,9 @@ Yields:
590636[class Component extends SvelteComponent]
591637```
592638
639+ Types for Svelte are broken.
640+ Raise it with Svelte.
641+
593642### Example: Vue
594643
595644> 👉 ** Note** : you must set ` elementAttributeNameCase: 'html' ` for Vue.
@@ -600,7 +649,7 @@ In Node.js, do:
600649import serverRenderer from ' @vue/server-renderer'
601650import {h } from ' hastscript'
602651import {toJsxRuntime } from ' hast-util-to-jsx-runtime'
603- import {Fragment , jsx , jsxs } from ' vue/jsx-runtime' // Available since `vue@^ 3.3.0-alpha.6 `.
652+ import {Fragment , jsx , jsxs } from ' vue/jsx-runtime' // Available since `vue@3.3`.
604653
605654console .log (
606655 await serverRenderer .renderToString (
@@ -640,6 +689,21 @@ function Component() {
640689}
641690```
642691
692+ To add proper type support,
693+ register a global JSX namespace:
694+
695+ ``` ts
696+ import type {JSX as Jsx } from ' vue/jsx-runtime'
697+
698+ declare global {
699+ namespace JSX {
700+ type ElementClass = Jsx .ElementClass
701+ type Element = Jsx .Element
702+ type IntrinsicElements = Jsx .IntrinsicElements
703+ }
704+ }
705+ ```
706+
643707## Syntax
644708
645709HTML is parsed according to WHATWG HTML (the living standard), which is also
@@ -653,7 +717,7 @@ versions of Node.js.
653717When we cut a new major release, we drop support for unmaintained versions of
654718Node.
655719This means we try to keep the current release line,
656- ` hast-util-to-jsx-runtime@^ 2 ` , compatible with Node.js 16.
720+ ` hast-util-to-jsx-runtime@2 ` , compatible with Node.js 16.
657721
658722## Security
659723
0 commit comments