@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 +1 -1
- package/src/useThunk.ts +3 -1
- package/types/useThunk.d.ts +2 -1
package/package.json
CHANGED
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
|
-
):
|
|
19
|
+
): UseThunk<S, R> => {
|
|
18
20
|
const { myClass } = theDo
|
|
19
21
|
|
|
20
22
|
// 1. dispatchMapByClass
|
package/types/useThunk.d.ts
CHANGED
|
@@ -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) =>
|
|
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;
|