mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Merge pull request #21730 from Knagis/react-redux-connect-options
react-redux: fix Options generic type arguments in connect()
This commit is contained in:
Vendored
+5
-5
@@ -120,28 +120,28 @@ export interface Connect {
|
||||
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,
|
||||
mapDispatchToProps: null | undefined,
|
||||
mergeProps: null | undefined,
|
||||
options: Options<TStateProps, TOwnProps>
|
||||
options: Options<State, TStateProps, TOwnProps>
|
||||
): InferableComponentEnhancerWithProps<DispatchProp<any> & TStateProps, TOwnProps>;
|
||||
|
||||
<no_state = {}, TDispatchProps = {}, TOwnProps = {}>(
|
||||
<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}>(
|
||||
mapStateToProps: null | undefined,
|
||||
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
|
||||
mergeProps: null | undefined,
|
||||
options: Options<no_state, TOwnProps>
|
||||
options: Options<{}, TStateProps, TOwnProps>
|
||||
): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>;
|
||||
|
||||
<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = {}>(
|
||||
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,
|
||||
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
|
||||
mergeProps: null | undefined,
|
||||
options: Options<TStateProps, TOwnProps>
|
||||
options: Options<State, TStateProps, TOwnProps>
|
||||
): InferableComponentEnhancerWithProps<TStateProps & TDispatchProps, TOwnProps>;
|
||||
|
||||
<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, TMergedProps = {}, State = {}>(
|
||||
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,
|
||||
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
|
||||
mergeProps: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>,
|
||||
options: Options<TStateProps, TOwnProps, TMergedProps>
|
||||
options: Options<State, TStateProps, TOwnProps, TMergedProps>
|
||||
): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
|
||||
}
|
||||
|
||||
|
||||
@@ -247,22 +247,26 @@ namespace MapStateAndDispatchAndMerge {
|
||||
}
|
||||
|
||||
namespace MapStateAndOptions {
|
||||
interface State { state: string; }
|
||||
interface OwnProps { foo: string }
|
||||
interface StateProps { bar: number }
|
||||
interface DispatchProps { dispatch: Dispatch<any> }
|
||||
|
||||
class TestComponent extends Component<OwnProps & StateProps & DispatchProps> {}
|
||||
|
||||
const mapStateToProps = () => ({
|
||||
const mapStateToProps = (state: State) => ({
|
||||
bar: 1
|
||||
})
|
||||
|
||||
const Test = connect(
|
||||
const areStatePropsEqual = (next: StateProps, current: StateProps) => true;
|
||||
|
||||
const Test = connect<StateProps, DispatchProps, OwnProps, State>(
|
||||
mapStateToProps,
|
||||
null,
|
||||
null,
|
||||
{
|
||||
pure: true
|
||||
pure: true,
|
||||
areStatePropsEqual,
|
||||
}
|
||||
)(TestComponent)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user