Skip to content

Commit 5b5b47e

Browse files
committed
Fix react enhancer types
1 parent d1dbe94 commit 5b5b47e

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

src/utils/reactStoreEnhancer.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,10 @@ import type { StoreEnhancer } from 'redux'
44

55
const { createStoreFromSource } = experimental
66

7-
export type Reducer<S, A> = (state: S, action: A) => S
8-
9-
export interface ISource<S, A> {
10-
/**
11-
* Returns an immutable snapshot of the current state
12-
*/
13-
getState(): S
14-
/**
15-
* A pure function which takes and arbitrary state and an updater/action and
16-
* returns a new state.
17-
*
18-
* React needs this in order to generate temporary states.
19-
*
20-
* See: https://jordaneldredge.com/notes/react-rebasing/
21-
*/
22-
reducer: Reducer<S, A>
23-
}
7+
export type ReactStore = ReturnType<typeof createStoreFromSource<any, any>>
248

259
export const addReactStore: StoreEnhancer<{
26-
reactStore: ReturnType<typeof createStoreFromSource<any, any>>
10+
reactStore: ReactStore
2711
}> = (createStore) => {
2812
return (reducer, preloadedState) => {
2913
const store = createStore(reducer, preloadedState)

0 commit comments

Comments
 (0)