@chhsiao1981/use-thunk 9.0.0 → 9.0.1

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": "@chhsiao1981/use-thunk",
3
- "version": "9.0.0",
3
+ "version": "9.0.1",
4
4
  "type": "module",
5
5
  "description": "A framework easily using useThunk to manage the data-state.",
6
6
  "homepage": "https://github.com/chhsiao1981/use-thunk",
package/src/useThunk.ts CHANGED
@@ -7,6 +7,8 @@ import type { ThunkModule, ThunkModuleFunc } from './thunk'
7
7
  import { DEFAULT_THUNK_MODULE_FUNC_MAP } from './thunkModuleFuncMap'
8
8
  import useThunkReducer from './thunkReducer'
9
9
 
10
+ export type UseThunk<S extends State, R extends ThunkModuleFunc<S>> = [ClassState<S>, DispatchFuncMap<S, R>]
11
+
10
12
  /**********
11
13
  * useThunk
12
14
  **********/
@@ -14,7 +16,7 @@ export default <S extends State, R extends ThunkModuleFunc<S>>(
14
16
  theDo: ThunkModule<S, R>,
15
17
  // biome-ignore lint/suspicious/noExplicitAny: params can by any types.
16
18
  init?: (...params: any[]) => S,
17
- ): [ClassState<S>, DispatchFuncMap<S, R>] => {
19
+ ): UseThunk<S, R> => {
18
20
  const { myClass } = theDo
19
21
 
20
22
  // 1. dispatchMapByClass
@@ -1,8 +1,9 @@
1
1
  import type { DispatchFuncMap } from './dispatchFuncMap';
2
2
  import type { ClassState, State } from './stateTypes';
3
3
  import type { ThunkModule, ThunkModuleFunc } from './thunk';
4
+ export type UseThunk<S extends State, R extends ThunkModuleFunc<S>> = [ClassState<S>, DispatchFuncMap<S, R>];
4
5
  /**********
5
6
  * useThunk
6
7
  **********/
7
- declare const _default: <S extends State, R extends ThunkModuleFunc<S>>(theDo: ThunkModule<S, R>, init?: (...params: any[]) => S) => [ClassState<S>, DispatchFuncMap<S, R>];
8
+ declare const _default: <S extends State, R extends ThunkModuleFunc<S>>(theDo: ThunkModule<S, R>, init?: (...params: any[]) => S) => UseThunk<S, R>;
8
9
  export default _default;