diff --git a/package.json b/package.json index 4122132..192645f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "use-local-slice", "description": "A react hook to use reducers for local state in a typesafe way, with an API like createSlice from redux-starter-kit and immer integration.", - "version": "1.1.0", + "version": "1.1.1", "repository": "https://github.com/phryneas/use-local-slice", "author": "phryneas", "license": "MIT", diff --git a/src/index.ts b/src/index.ts index 7242abd..754edfa 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,12 +2,12 @@ import { useReducer, useMemo, useDebugValue } from "react"; import produce, { Draft } from "immer"; -type PayloadAction

= { +export type PayloadAction

= { type: string; payload: P; }; -type PayloadActionDispatch

= void extends P +export type PayloadActionDispatch

= void extends P ? () => void : (payload: P) => void; @@ -22,7 +22,7 @@ export type ReducerMap = { [actionType: string]: PayloadActionReducer; }; -type DispatcherMap> = { +export type DispatcherMap> = { [T in keyof Reducers]: Reducers[T] extends RedurcerWithoutPayload ? PayloadActionDispatch : Reducers[T] extends PayloadActionReducer