@use-stall/types 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/utils/react.d.ts +30 -14
package/package.json
CHANGED
package/src/utils/react.d.ts
CHANGED
|
@@ -1,23 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export type ReactText = string | number;
|
|
2
|
+
export type ReactChild = ReactElement | ReactText;
|
|
3
|
+
export type ReactFragment = Iterable<ReactNode>;
|
|
4
|
+
|
|
5
|
+
export interface ReactPortal {
|
|
6
|
+
key: string | null;
|
|
7
|
+
children: ReactNode; // ← this is what was missing
|
|
8
|
+
type: string | ComponentType<any>;
|
|
9
|
+
props: any;
|
|
10
|
+
}
|
|
8
11
|
|
|
9
|
-
// Basic React node types to avoid any React import
|
|
10
12
|
export type ReactNode =
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
+
| ReactChild
|
|
14
|
+
| ReactFragment
|
|
15
|
+
| ReactPortal
|
|
13
16
|
| boolean
|
|
14
17
|
| null
|
|
15
|
-
| undefined
|
|
16
|
-
| ReactElement
|
|
17
|
-
| ReactNode[];
|
|
18
|
+
| undefined;
|
|
18
19
|
|
|
19
20
|
export interface ReactElement<P = any> {
|
|
20
21
|
type: string | ComponentType<P>;
|
|
21
22
|
props: P;
|
|
22
|
-
key: string |
|
|
23
|
+
key: string | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Matches React.ComponentType<P> exactly — accepts both function and class components.
|
|
28
|
+
*/
|
|
29
|
+
export type ComponentType<P = {}> =
|
|
30
|
+
| FunctionComponent<P>
|
|
31
|
+
| ComponentClass<P>;
|
|
32
|
+
|
|
33
|
+
export interface FunctionComponent<P = {}> {
|
|
34
|
+
(props: P): ReactElement<any> | null; // ← return ReactElement | null, NOT ReactNode
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ComponentClass<P = {}> {
|
|
38
|
+
new(props: P): { render(): ReactNode };
|
|
23
39
|
}
|