@tramvai/state 5.53.142 → 5.53.144

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.
@@ -1,16 +1,16 @@
1
1
  import type { Action, TramvaiAction } from '@tramvai/types-actions-state-context';
2
- export declare function useActions<P extends any[], R, Deps = any>(action: TramvaiAction<P, R, Deps>): (...args: P) => Promise<R extends Promise<infer U> ? U : R>;
3
- export declare function useActions<A extends TramvaiAction<any, any, any>[]>(actions: A): {
4
- [key in keyof A]: (...args: any[]) => Promise<any>;
5
- };
6
- export declare function useActions<A extends Readonly<TramvaiAction<any, any, any>[]>>(actions: A): {
2
+ export declare function useActions<const A extends Readonly<TramvaiAction<any, any, any>[]>>(actions: A): {
7
3
  [Key in keyof A]: A[Key] extends TramvaiAction<infer P, infer R, any> ? (...args: P) => Promise<R extends Promise<infer U> ? U : R> : never;
8
4
  };
9
- export declare function useActions<P, R>(action: Action<P, R>): (payload?: P) => Promise<R extends PromiseLike<infer U> ? U : R>;
10
- export declare function useActions<A extends Action<any, any>[]>(actions: A): {
11
- [key in keyof A]: (payload?: any) => Promise<any>;
5
+ export declare function useActions<const P extends any[], R, Deps = any>(action: TramvaiAction<P, R, Deps>): (...args: P) => Promise<R extends Promise<infer U> ? U : R>;
6
+ export declare function useActions<const A extends TramvaiAction<any, any, any>[]>(actions: A): {
7
+ [key in keyof A]: (...args: any[]) => Promise<any>;
12
8
  };
13
- export declare function useActions<A extends Readonly<Action<any, any>[]>>(actions: A): {
9
+ export declare function useActions<const A extends Readonly<Action<any, any>[]>>(actions: A): {
14
10
  [Key in keyof A]: A[Key] extends Action<infer P, infer R> ? (payload?: P) => Promise<R extends PromiseLike<infer U> ? U : R> : never;
15
11
  };
12
+ export declare function useActions<const P, R>(action: Action<P, R>): (payload?: P) => Promise<R extends PromiseLike<infer U> ? U : R>;
13
+ export declare function useActions<const A extends Action<any, any>[]>(actions: A): {
14
+ [key in keyof A]: (payload?: any) => Promise<any>;
15
+ };
16
16
  //# sourceMappingURL=useActions.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import type { Event, EventCreatorN } from '@tramvai/types-actions-state-context';
2
2
  type ConvertEventToDispatch<Ev extends EventCreatorN<any>> = Ev extends (...args: infer T) => Event<infer P> ? (...args: T) => P : never;
3
- export declare function useEvents<Ev extends EventCreatorN<any>>(event: Ev): ConvertEventToDispatch<Ev>;
4
- export declare function useEvents<Ev extends Readonly<EventCreatorN<any>[]>>(events: Ev): {
3
+ export declare function useEvents<const Ev extends EventCreatorN<any>>(event: Ev): ConvertEventToDispatch<Ev>;
4
+ export declare function useEvents<const Ev extends Readonly<EventCreatorN<any>[]>>(events: Ev): {
5
5
  [key in keyof Ev]: ConvertEventToDispatch<Ev[key]>;
6
6
  };
7
7
  export {};
@@ -7,24 +7,24 @@ type OptionalStoreType<S = any, N extends string = string> = {
7
7
  store: Reducer<S, N> | string;
8
8
  optional: true;
9
9
  };
10
- export declare function useSelector<T, S extends string>(storesOrStore: S, selector: (state: {
10
+ export declare function useSelector<T, const S extends string>(storesOrStore: S, selector: (state: {
11
11
  [key in S]: any;
12
12
  }) => T, equalityFn?: typeof shallowEqual): T;
13
- export declare function useSelector<T, S extends OptionalStoreType>(storesOrStore: S, selector: (state: S['store'] extends Reducer<any> ? {
13
+ export declare function useSelector<T, const S extends OptionalStoreType>(storesOrStore: S, selector: (state: S['store'] extends Reducer<any> ? {
14
14
  [key in S['store']['storeName']]: InferStoreStateFromReducer<S['store']>;
15
15
  } : S['store'] extends string ? {
16
16
  [key in S['store']]: any;
17
17
  } : Record<string, any>) => T, equalityFn?: typeof shallowEqual): T;
18
- export declare function useSelector<T, R extends Reducer<any>>(storesOrStore: R, selector: (state: {
18
+ export declare function useSelector<T, const R extends Reducer<any>>(storesOrStore: R, selector: (state: {
19
19
  [key in R['storeName']]: InferStoreStateFromReducer<R>;
20
20
  }) => T, equalityFn?: typeof shallowEqual): T;
21
- export declare function useSelector<T, R extends BaseStoreConstructor<any>>(storesOrStore: R, selector: (state: {
21
+ export declare function useSelector<T, const R extends BaseStoreConstructor<any>>(storesOrStore: R, selector: (state: {
22
22
  [key in R['storeName']]: InferStoreStateFromLegacyStore<R>;
23
23
  }) => T, equalityFn?: typeof shallowEqual): T;
24
- export declare function useSelector<T, S extends ReadonlyArray<unknown>>(storesOrStore: S, selector: (state: {
24
+ export declare function useSelector<T, const S extends ReadonlyArray<unknown>>(storesOrStore: S, selector: (state: {
25
25
  [Key in Indices<S> as InferStoreNameFromUnknownStore<S[Key]>]: InferStoreStateFromUnknownStore<S[Key]>;
26
26
  }) => T, equalityFn?: typeof shallowEqual): T;
27
- export declare function useSelector<T, S>(storesOrStore: S, selector: (state: Record<string, any>) => T, equalityFn?: typeof shallowEqual): T;
27
+ export declare function useSelector<T, const S>(storesOrStore: S, selector: (state: Record<string, any>) => T, equalityFn?: typeof shallowEqual): T;
28
28
  type DEFAULT_STORE_NAME = string;
29
29
  type DEFAULT_STORE_STATE = any;
30
30
  type InferStoreNameFromOptionalStore<Store extends OptionalStoreType> = Store['store'] extends Reducer<any, infer Name> ? Name : DEFAULT_STORE_NAME;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/state",
3
- "version": "5.53.142",
3
+ "version": "5.53.144",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -19,7 +19,7 @@
19
19
  "dependencies": {
20
20
  "@tinkoff/react-hooks": "0.4.6",
21
21
  "@tinkoff/utils": "^2.1.2",
22
- "@tramvai/types-actions-state-context": "5.53.142",
22
+ "@tramvai/types-actions-state-context": "5.53.144",
23
23
  "@types/hoist-non-react-statics": "^3.3.6",
24
24
  "invariant": "^2.2.4",
25
25
  "react-is": ">=17",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "@reatom/core": "^1.1.5",
36
- "@tramvai/core": "5.53.142",
36
+ "@tramvai/core": "5.53.144",
37
37
  "@types/invariant": "^2.2.31",
38
38
  "@types/react-is": "^17.0.0",
39
39
  "@types/use-sync-external-store": "^0.0.3",