Skip to content

Commit

Permalink
export all types
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas committed Aug 1, 2019
1 parent 85c0a5f commit 163a9c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { useReducer, useMemo, useDebugValue } from "react";

import produce, { Draft } from "immer";

type PayloadAction<P> = {
export type PayloadAction<P> = {
type: string;
payload: P;
};

type PayloadActionDispatch<P = void> = void extends P
export type PayloadActionDispatch<P = void> = void extends P
? () => void
: (payload: P) => void;

Expand All @@ -22,7 +22,7 @@ export type ReducerMap<State> = {
[actionType: string]: PayloadActionReducer<State, any>;
};

type DispatcherMap<Reducers extends ReducerMap<any>> = {
export type DispatcherMap<Reducers extends ReducerMap<any>> = {
[T in keyof Reducers]: Reducers[T] extends RedurcerWithoutPayload<any>
? PayloadActionDispatch<void>
: Reducers[T] extends PayloadActionReducer<any, infer P>
Expand Down

0 comments on commit 163a9c6

Please sign in to comment.