@@ -10,9 +10,9 @@ import type {Element} from 'hast'
10
10
* @returns
11
11
* Result.
12
12
*/
13
- export type FunctionComponent < ComponentProps > = (
13
+ export type FunctionComponent < JsxElement , ComponentProps > = (
14
14
props : ComponentProps
15
- ) => JSX . Element | string | null | undefined
15
+ ) => JsxElement | string | null | undefined
16
16
17
17
/**
18
18
* Class component: given props, returns an instance.
@@ -24,22 +24,22 @@ export type FunctionComponent<ComponentProps> = (
24
24
* @returns
25
25
* Instance.
26
26
*/
27
- export type ClassComponent < ComponentProps > = new (
27
+ export type ClassComponent < JsxElementClass , ComponentProps > = new (
28
28
props : ComponentProps
29
- ) => JSX . ElementClass
29
+ ) => JsxElementClass
30
30
31
31
/**
32
32
* Function or class component.
33
33
*
34
- * You can access props at `JSX .IntrinsicElements`.
35
- * For example, to find props for `a`, use `JSX .IntrinsicElements['a']`.
34
+ * You can access props at `LocalJsx .IntrinsicElements`.
35
+ * For example, to find props for `a`, use `LocalJsx .IntrinsicElements['a']`.
36
36
*
37
37
* @typeParam ComponentProps
38
38
* Props type.
39
39
*/
40
- export type Component < ComponentProps > =
41
- | ClassComponent < ComponentProps >
42
- | FunctionComponent < ComponentProps >
40
+ export type Component < JsxElement , JsxElementClass , ComponentProps > =
41
+ | ClassComponent < JsxElementClass , ComponentProps >
42
+ | FunctionComponent < JsxElement , ComponentProps >
43
43
44
44
/**
45
45
* Extra fields we pass.
@@ -49,17 +49,21 @@ export type ExtraProps = {node?: Element | undefined}
49
49
/**
50
50
* Possible components to use.
51
51
*
52
- * Each key is a tag name typed in `JSX .IntrinsicElements`.
52
+ * Each key is a tag name typed in `LocalJsx .IntrinsicElements`.
53
53
* Each value is either a different tag name, or a component accepting the
54
54
* corresponding props (and an optional `node` prop if `passNode` is on).
55
55
*
56
- * You can access props at `JSX .IntrinsicElements`.
57
- * For example, to find props for `a`, use `JSX .IntrinsicElements['a']`.
56
+ * You can access props at `LocalJsx .IntrinsicElements`.
57
+ * For example, to find props for `a`, use `LocalJsx .IntrinsicElements['a']`.
58
58
*/
59
59
// Note: this type has to be in `.ts` or `.d.ts`, otherwise TSC hardcodes
60
60
// react into the `.d.ts` file.
61
- export type Components = {
62
- [ TagName in keyof JSX . IntrinsicElements ] :
63
- | Component < JSX . IntrinsicElements [ TagName ] & ExtraProps >
64
- | keyof JSX . IntrinsicElements
61
+ export type Components < JsxElement , JsxElementClass , JsxIntrinsicElements > = {
62
+ [ TagName in keyof JsxIntrinsicElements ] :
63
+ | Component <
64
+ JsxElement ,
65
+ JsxElementClass ,
66
+ JsxIntrinsicElements [ TagName ] & ExtraProps
67
+ >
68
+ | keyof JsxIntrinsicElements
65
69
}
0 commit comments