UNPKG

1.05 kBPlain TextView Raw
1import type {ComponentType} from 'react'
2import type {Element} from 'hast'
3
4interface WithNode {
5 node: Element
6}
7
8export interface ComponentsWithNodeOptions {
9 /**
10 * Expose hast elements as a `node` field in components
11 */
12 passNode: true
13 /**
14 * Override default elements (such as `<a>`, `<p>`, etcetera) by passing an
15 * object mapping tag names to components.
16 */
17 components?: Partial<
18 {
19 [TagName in keyof JSX.IntrinsicElements]:
20 | keyof JSX.IntrinsicElements
21 | ComponentType<WithNode & JSX.IntrinsicElements[TagName]>
22 }
23 >
24}
25
26export interface ComponentsWithoutNodeOptions {
27 /**
28 * Expose hast elements as a `node` field in components.
29 */
30 passNode?: false | undefined
31
32 /**
33 * Override default elements (such as `<a>`, `<p>`, etcetera) by passing an
34 * object mapping tag names to components.
35 */
36 components?: Partial<
37 {
38 [TagName in keyof JSX.IntrinsicElements]:
39 | keyof JSX.IntrinsicElements
40 | ComponentType<JSX.IntrinsicElements[TagName]>
41 }
42 >
43}