Skip to content

Commit

Permalink
refactor(middleware/combine.ts): change exported function to 'functio…
Browse files Browse the repository at this point in the history
…n declaration' (#3030)
  • Loading branch information
sukvvon authored Feb 27, 2025
1 parent bc60812 commit 8ced271
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/middleware/combine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

0 comments on commit 8ced271

Please sign in to comment.