@use-stall/types 0.3.1 → 0.3.3
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 +27 -16
package/package.json
CHANGED
package/src/utils/react.d.ts
CHANGED
|
@@ -1,23 +1,34 @@
|
|
|
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;
|
|
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
|
-
props: P;
|
|
22
|
-
key: string |
|
|
23
|
-
}
|
|
22
|
+
props: P & { children?: ReactNode }; // ← children must be here
|
|
23
|
+
key: string | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface FunctionComponent<P = {}> {
|
|
27
|
+
(props: P): ReactElement<any> | null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ComponentClass<P = {}> {
|
|
31
|
+
new (props: P): { render(): ReactNode };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type ComponentType<P = {}> = FunctionComponent<P> | ComponentClass<P>;
|