combine.ts
This file
Path
src/middleware/combine.ts
15 lines · 478 bytes · TypeScript
Last changed by
Not known.
History of this fileTake it
The walk stopped after 200 commits: lines older than f85898f point at it.
chore(eslint.config.mjs): update 'eslint-plugin-react-hooks', 'eslint-plugin-react-compiler' config (#3043)Wonsuk Choibefore adoptionf85898f
lines 1–15why, one step back1import type { StateCreator, StoreMutatorIdentifier } from '../vanilla.ts'23type Write<T, U> = Omit<T, keyof U> & U45export function combine<6 T extends object,7 U extends object,8 Mps extends [StoreMutatorIdentifier, unknown][] = [],9 Mcs extends [StoreMutatorIdentifier, unknown][] = [],10>(11 initialState: T,12 create: StateCreator<T, Mps, Mcs, U>,13): StateCreator<Write<T, U>, Mps, Mcs> {14 return (...args) => Object.assign({}, initialState, (create as any)(...args))15}