@use-stall/types 0.3.0 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@use-stall/types",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Type declarations for Stall SDKs",
5
5
  "types": "index.d.ts",
6
6
  "type": "module",
@@ -123,7 +123,7 @@ type ExtensionLookupGroup = LocalListUIComponent | RemoteListUIComponent;
123
123
 
124
124
  interface UIProps {
125
125
  item: any;
126
- search_query: string;
126
+ search_query: Record<string, string>;
127
127
  base_currency: string;
128
128
  active_cart: UnifiedOrderType | null;
129
129
  BackButton: ComponentType<any>;
@@ -1,23 +1,39 @@
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; // 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
- | 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
22
  props: P;
22
- key: string | number | null;
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
  }