mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
refactor(middleware/combine.ts): change exported function to 'function declaration' (#3030)
This commit is contained in:
parent
bc60812e33
commit
8ced2719ac
@ -2,17 +2,14 @@ import type { StateCreator, StoreMutatorIdentifier } from '../vanilla.ts'
|
||||
|
||||
type Write<T, U> = Omit<T, keyof U> & U
|
||||
|
||||
type Combine = <
|
||||
export function combine<
|
||||
T extends object,
|
||||
U extends object,
|
||||
Mps extends [StoreMutatorIdentifier, unknown][] = [],
|
||||
Mcs extends [StoreMutatorIdentifier, unknown][] = [],
|
||||
>(
|
||||
initialState: T,
|
||||
additionalStateCreator: StateCreator<T, Mps, Mcs, U>,
|
||||
) => StateCreator<Write<T, U>, Mps, Mcs>
|
||||
|
||||
export const combine: Combine =
|
||||
(initialState, create) =>
|
||||
(...a) =>
|
||||
Object.assign({}, initialState, (create as any)(...a))
|
||||
create: StateCreator<T, Mps, Mcs, U>,
|
||||
): StateCreator<Write<T, U>, Mps, Mcs> {
|
||||
return (...a) => Object.assign({}, initialState, (create as any)(...a))
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user