@@ -144,25 +144,29 @@ Static JSX ([`Jsx`][jsx], required in production).
144144
145145Development JSX ([ ` JsxDev ` ] [ jsxdev ] , required in development).
146146
147+ ###### ` development `
148+
149+ Whether to use ` jsxDEV ` when on or ` jsx ` and ` jsxs ` when off (` boolean ` ,
150+ default: ` false ` ).
151+
147152###### ` components `
148153
149154Components to use ([ ` Partial<Components> ` ] [ components ] , optional).
150155
151156Each key is the name of an HTML (or SVG) element to override.
152157The value is the component to render instead.
153158
154- ###### ` development `
155-
156- Whether to use ` jsxDEV ` when on or ` jsx ` and ` jsxs ` when off (` boolean ` ,
157- default: ` false ` ).
158-
159159###### ` filePath `
160160
161161File path to the original source file (` string ` , optional).
162162
163163Passed in source info to ` jsxDEV ` when using the automatic runtime with
164164` development: true ` .
165165
166+ ###### ` passNode `
167+
168+ Pass the hast element node to components (` boolean ` , default: ` false ` ).
169+
166170###### ` space `
167171
168172Whether ` tree ` is in the ` 'html' ` or ` 'svg' ` space ([ ` Space ` ] [ space ] , default:
@@ -183,21 +187,25 @@ it.
183187Possible components to use (TypeScript type).
184188
185189Each key is a tag name typed in ` JSX.IntrinsicElements ` .
186- Each value is a component accepting the corresponding props or a different tag
187- name .
190+ Each value is either a different tag name, or a component accepting the
191+ corresponding props (and an optional ` node ` prop if ` passNode ` is on) .
188192
189193You can access props at ` JSX.IntrinsicElements ` .
190194For example, to find props for ` a ` , use ` JSX.IntrinsicElements['a'] ` .
191195
192196###### Type
193197
194198``` ts
199+ import type {Element } from ' hast'
200+
195201type Components = {
196202 [TagName in keyof JSX .IntrinsicElements ]:
197- | Component <JSX .IntrinsicElements [TagName ]>
203+ | Component <JSX .IntrinsicElements [TagName ] & ExtraProps >
198204 | keyof JSX .IntrinsicElements
199205}
200206
207+ type ExtraProps = {node? : Element | undefined }
208+
201209type Component <ComponentProps > =
202210 // Function component:
203211 | ((props : ComponentProps ) => JSX .Element | string | null | undefined )
@@ -222,7 +230,7 @@ Create a production element (TypeScript type).
222230###### Parameters
223231
224232* ` type ` ( ` unknown ` )
225- — element type: the ` Fragment ` symbol or a tag name ( ` string ` )
233+ — element type: ` Fragment ` symbol, tag name ( ` string ` ), component
226234* ` props ` ([ ` Props ` ][props])
227235 — element props and also includes ` children `
228236* ` key ` ( ` string ` or ` undefined ` )
@@ -239,7 +247,7 @@ Create a development element (TypeScript type).
239247###### Parameters
240248
241249* ` type ` ( ` unknown ` )
242- — element type: the ` Fragment ` symbol or a tag name ( ` string ` )
250+ — element type: ` Fragment ` symbol, tag name ( ` string ` ), component
243251* ` props ` ([ ` Props ` ][props])
244252 — element props and also includes ` children `
245253* ` key ` ( ` string ` or ` undefined ` )
0 commit comments