Skip to content

Commit

Permalink
Fix types issues with context props
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Oct 3, 2021
1 parent e729165 commit 8ec5802
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/components/Provider.tsx
Expand Up @@ -15,7 +15,7 @@ export interface ProviderProps<A extends Action = AnyAction> {
* If this is used, you'll need to customize `connect` by supplying the same context provided to the Provider.
* Initial value doesn't matter, as it is overwritten with the internal state of Provider.
*/
context?: Context<ReactReduxContextValue | null>
context?: Context<ReactReduxContextValue>
children: ReactNode
}

Expand Down
6 changes: 3 additions & 3 deletions src/components/connect.tsx
Expand Up @@ -425,9 +425,9 @@ function connect<
TMergedProps = {},
State = DefaultRootState
>(
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
mergeProps: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>,
mapStateToProps?: MapStateToPropsParam<TStateProps, TOwnProps, State>,
mapDispatchToProps?: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
mergeProps?: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>,
options?: ConnectOptions<State, TStateProps, TOwnProps, TMergedProps>
): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps & ConnectProps>

Expand Down
19 changes: 9 additions & 10 deletions test/components/connect.spec.tsx
Expand Up @@ -2154,10 +2154,9 @@ describe('React', () => {
}
}

const context = React.createContext<ReactReduxContextValue<
any,
AnyAction
> | null>(null)
const context = React.createContext<
ReactReduxContextValue<any, AnyAction>
>(null as any)

let actualState

Expand Down Expand Up @@ -2196,10 +2195,9 @@ describe('React', () => {
}
}

const context = React.createContext<ReactReduxContextValue<
any,
AnyAction
> | null>(null)
const context = React.createContext<
ReactReduxContextValue<any, AnyAction>
>(null as any)

let actualState

Expand Down Expand Up @@ -2451,8 +2449,9 @@ describe('React', () => {
(state: RootStateType = 0, action: ActionType) =>
action.type === 'INC' ? state + 1 : state
)
const customContext =
React.createContext<ReactReduxContextValue | null>(null)
const customContext = React.createContext<ReactReduxContextValue>(
null as any
)

class A extends Component {
render() {
Expand Down

0 comments on commit 8ec5802

Please sign in to comment.