Skip to content

Commit

Permalink
update immer to v3
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas committed Jul 11, 2019
1 parent 56ec0c0 commit 6fdd765
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"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.0.1",
"version": "1.1.0",
"repository": "https://github.com/phryneas/use-local-slice",
"author": "phryneas",
"license": "MIT",
"private": false,
"sideEffects": false,
"dependencies": {
"immer": "^1.12.1"
"immer": "^3.1.3"
},
"peerDependencies": {
"react": ">=16.8.0"
Expand Down Expand Up @@ -51,4 +51,4 @@
"immer",
"redux"
]
}
}
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useReducer, useMemo, useDebugValue, useState } from "react";
import { useReducer, useMemo, useDebugValue } from "react";

import produce, { Draft } from "immer";

Expand All @@ -24,16 +24,16 @@ export type ReducerMap<State> = {

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

export interface UseLocalSliceOptions<
State,
Reducers extends ReducerMap<State>
> {
> {
initialState: State;
reducers: Reducers;
slice?: string;
Expand Down
7 changes: 4 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2643,9 +2643,10 @@ iltorb@^2.0.5:
prebuild-install "^5.2.4"
which-pm-runs "^1.0.0"

immer@^1.12.1:
version "1.12.1"
resolved "https://registry.yarnpkg.com/immer/-/immer-1.12.1.tgz#40c6e5b292c00560836c2993bda3a24379d466f5"
immer@^3.1.3:
version "3.1.3"
resolved "https://registry.yarnpkg.com/immer/-/immer-3.1.3.tgz#59bc742b2aab6e2c676445edb653e588a23c70fc"
integrity sha512-HG5SXTXTTVy9lGNwS075cNhQoV375jHsIJO3UtMjuUWJOuwlMr0u42FlsKTJcppt5AzsFAsmj9r4kHvsSHh3hQ==

import-cwd@^2.1.0:
version "2.1.0"
Expand Down

0 comments on commit 6fdd765

Please sign in to comment.