@@ -2,24 +2,27 @@ import React, { Context, ReactNode, useMemo } from 'react'
2
2
import { ReactReduxContext , ReactReduxContextValue } from './Context'
3
3
import { createSubscription } from '../utils/Subscription'
4
4
import { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect'
5
- import type { FixTypeLater } from '../types'
6
5
import { Action , AnyAction , Store } from 'redux'
7
6
8
7
export interface ProviderProps < A extends Action = AnyAction > {
9
8
/**
10
9
* The single Redux store in your application.
11
10
*/
12
- store : Store < FixTypeLater , A >
11
+ store : Store < any , A >
13
12
/**
14
13
* Optional context to be used internally in react-redux. Use React.createContext() to create a context to be used.
15
14
* If this is used, you'll need to customize `connect` by supplying the same context provided to the Provider.
16
15
* Initial value doesn't matter, as it is overwritten with the internal state of Provider.
17
16
*/
18
- context ?: Context < ReactReduxContextValue >
17
+ context ?: Context < ReactReduxContextValue < any , A > >
19
18
children : ReactNode
20
19
}
21
20
22
- function Provider ( { store, context, children } : ProviderProps ) {
21
+ function Provider < A extends Action = AnyAction > ( {
22
+ store,
23
+ context,
24
+ children,
25
+ } : ProviderProps < A > ) {
23
26
const contextValue = useMemo ( ( ) => {
24
27
const subscription = createSubscription ( store )
25
28
return {
@@ -46,6 +49,7 @@ function Provider({ store, context, children }: ProviderProps) {
46
49
47
50
const Context = context || ReactReduxContext
48
51
52
+ // @ts -ignore 'AnyAction' is assignable to the constraint of type 'A', but 'A' could be instantiated with a different subtype
49
53
return < Context . Provider value = { contextValue } > { children } </ Context . Provider >
50
54
}
51
55
0 commit comments