@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@use-stall/types",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Type declarations for Stall SDKs",
5
5
  "types": "index.d.ts",
6
6
  "type": "module",
@@ -1,23 +1,34 @@
1
- /**
2
- * A React component either a function component or a class component —
3
- * that accepts props of type P.
4
- */
5
- export type ComponentType<P = {}> =
6
- | ((props: P & { children?: ReactNode }) => ReactNode)
7
- | (new (props: P & { children?: ReactNode }) => { render(): ReactNode });
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
- | string
12
- | number
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 | number | null;
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>;