fix: ts error TS2742

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei 2024-07-30 23:07:08 +08:00
parent 643de2a42e
commit e39bfb159e
No known key found for this signature in database
GPG Key ID: 0F62D33977F021F7
4 changed files with 24 additions and 14 deletions

View File

@ -168,7 +168,8 @@
"pnpm": {
"patchedDependencies": {
"sonner@1.5.0": "patches/sonner@1.5.0.patch",
"hono@4.4.7": "patches/hono@4.4.7.patch"
"hono@4.4.7": "patches/hono@4.4.7.patch",
"immer@10.1.1": "patches/immer@10.1.1.patch"
}
},
"simple-git-hooks": {

View File

@ -0,0 +1,13 @@
diff --git a/dist/immer.d.ts b/dist/immer.d.ts
index 2cb6cddda28d1fb226fc9dc5fc4b64ec7fc55a9c..161cf402a794712dc700c6b63c138622b0a3dc4c 100644
--- a/dist/immer.d.ts
+++ b/dist/immer.d.ts
@@ -48,7 +48,7 @@ type PatchListener = (patches: Patch[], inversePatches: Patch[]) => void;
* Utility types
*/
type PatchesTuple<T> = readonly [T, Patch[], Patch[]];
-type ValidRecipeReturnType<State> = State | void | undefined | (State extends undefined ? typeof NOTHING : never);
+export type ValidRecipeReturnType<State> = State | void | undefined | (State extends undefined ? typeof NOTHING : never);
type ReturnTypeWithPatchesIfNeeded<State, UsePatches extends boolean> = UsePatches extends true ? PatchesTuple<State> : State;
/**
* Core Producer inference

View File

@ -8,6 +8,9 @@ patchedDependencies:
hono@4.4.7:
hash: ycbk46disqruhfjducp47b5fl4
path: patches/hono@4.4.7.patch
immer@10.1.1:
hash: og7mbnoo5vh43tjlw5rbmrdbvu
path: patches/immer@10.1.1.patch
sonner@1.5.0:
hash: 6s3tquyt5wnkqaogymn3mkivuq
path: patches/sonner@1.5.0.patch
@ -186,7 +189,7 @@ importers:
version: 6.2.1
immer:
specifier: 10.1.1
version: 10.1.1
version: 10.1.1(patch_hash=og7mbnoo5vh43tjlw5rbmrdbvu)
jotai:
specifier: 2.9.1
version: 2.9.1(@types/react@18.3.3)(react@18.3.1)
@ -288,7 +291,7 @@ importers:
version: 3.23.8
zustand:
specifier: 4.5.4
version: 4.5.4(@types/react@18.3.3)(immer@10.1.1)(react@18.3.1)
version: 4.5.4(@types/react@18.3.3)(immer@10.1.1(patch_hash=og7mbnoo5vh43tjlw5rbmrdbvu))(react@18.3.1)
devDependencies:
'@egoist/tailwindcss-icons':
specifier: 1.8.1
@ -11534,7 +11537,7 @@ snapshots:
immediate@3.0.6: {}
immer@10.1.1: {}
immer@10.1.1(patch_hash=og7mbnoo5vh43tjlw5rbmrdbvu): {}
import-fresh@3.3.0:
dependencies:
@ -13963,12 +13966,12 @@ snapshots:
zod@3.23.8: {}
zustand@4.5.4(@types/react@18.3.3)(immer@10.1.1)(react@18.3.1):
zustand@4.5.4(@types/react@18.3.3)(immer@10.1.1(patch_hash=og7mbnoo5vh43tjlw5rbmrdbvu))(react@18.3.1):
dependencies:
use-sync-external-store: 1.2.0(react@18.3.1)
optionalDependencies:
'@types/react': 18.3.3
immer: 10.1.1
immer: 10.1.1(patch_hash=og7mbnoo5vh43tjlw5rbmrdbvu)
react: 18.3.1
zwitch@2.0.4: {}

View File

@ -3,18 +3,11 @@ import type {
QueryFunction,
QueryKey,
} from "@tanstack/react-query"
import type { Draft, nothing } from "immer"
import type { Draft, ValidRecipeReturnType } from "immer"
import { produce } from "immer"
import { queryClient } from "./query-client"
// From immer, but immer not export this type
type ValidRecipeReturnType<State> =
| State
| void
| undefined
| (State extends undefined ? typeof nothing : never)
export type DefinedQuery<TQueryKey extends QueryKey, TData> = Readonly<{
key: TQueryKey
fn: QueryFunction<TData>