cogsbox-state 0.5.138 → 0.5.140
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/dist/CogsState.d.ts +4 -3
- package/dist/CogsState.jsx +174 -164
- package/dist/CogsState.jsx.map +1 -1
- package/package.json +1 -1
package/dist/CogsState.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export type FormElementParams<T> = {
|
|
|
36
36
|
};
|
|
37
37
|
export type StateKeys = string;
|
|
38
38
|
type findWithFuncType<U> = (thisKey: keyof U, thisValue: U[keyof U]) => EndType<U> & StateObject<U>;
|
|
39
|
-
export type PushArgs<U> = (update: Prettify<U> | ((prevState: NonNullable<Prettify<U>>[]) => NonNullable<Prettify<U>>), opts?: UpdateOpts<U>) =>
|
|
39
|
+
export type PushArgs<U, T> = (update: Prettify<U> | ((prevState: NonNullable<Prettify<U>>[]) => NonNullable<Prettify<U>>), opts?: UpdateOpts<U>) => StateObject<T>;
|
|
40
40
|
type CutFunctionType = (index?: number, options?: {
|
|
41
41
|
waitForSync?: boolean;
|
|
42
42
|
}) => void;
|
|
@@ -44,11 +44,11 @@ export type InferArrayElement<T> = T extends (infer U)[] ? U : never;
|
|
|
44
44
|
export type ArrayEndType<TShape extends unknown> = {
|
|
45
45
|
findWith: findWithFuncType<InferArrayElement<TShape>>;
|
|
46
46
|
index: (index: number) => StateObject<InferArrayElement<TShape>> & {
|
|
47
|
-
insert: PushArgs<InferArrayElement<TShape
|
|
47
|
+
insert: PushArgs<InferArrayElement<TShape>, TShape>;
|
|
48
48
|
cut: CutFunctionType;
|
|
49
49
|
_index: number;
|
|
50
50
|
} & EndType<InferArrayElement<TShape>>;
|
|
51
|
-
insert: PushArgs<InferArrayElement<TShape
|
|
51
|
+
insert: PushArgs<InferArrayElement<TShape>, TShape>;
|
|
52
52
|
cut: CutFunctionType;
|
|
53
53
|
cutByValue: (value: string | number | boolean) => void;
|
|
54
54
|
toggleByValue: (value: string | number | boolean) => void;
|
|
@@ -61,6 +61,7 @@ export type ArrayEndType<TShape extends unknown> = {
|
|
|
61
61
|
stateFilter: (callbackfn: (value: InferArrayElement<TShape>, index: number) => void) => ArrayEndType<TShape>;
|
|
62
62
|
getSelected: () => StateObject<InferArrayElement<TShape>> | undefined;
|
|
63
63
|
getSelectedIndex: () => number;
|
|
64
|
+
last: () => StateObject<InferArrayElement<TShape>> | undefined;
|
|
64
65
|
} & EndType<TShape> & {
|
|
65
66
|
[K in keyof (any[] extends infer T ? T : never)]: never;
|
|
66
67
|
};
|