1
1
import type { Dispatch } from 'redux'
2
2
import connectAdvanced from '../components/connectAdvanced'
3
+ import type { ConnectAdvancedOptions } from '../components/connectAdvanced'
3
4
import shallowEqual from '../utils/shallowEqual'
4
5
import defaultMapDispatchToPropsFactories from './mapDispatchToProps'
5
6
import defaultMapStateToPropsFactories from './mapStateToProps'
@@ -9,6 +10,7 @@ import defaultSelectorFactory, {
9
10
MapDispatchToPropsParam ,
10
11
MergeProps ,
11
12
} from './selectorFactory'
13
+ import type { DefaultRootState } from '../types'
12
14
13
15
/*
14
16
connect is a facade over connectAdvanced. It turns its args into a compatible
@@ -50,6 +52,31 @@ function strictEqual(a: unknown, b: unknown) {
50
52
return a === b
51
53
}
52
54
55
+ export interface ConnectOptions <
56
+ State = DefaultRootState ,
57
+ TStateProps = { } ,
58
+ TOwnProps = { } ,
59
+ TMergedProps = { }
60
+ > extends ConnectAdvancedOptions {
61
+ pure ?: boolean | undefined
62
+ areStatesEqual ?: ( ( nextState : State , prevState : State ) => boolean ) | undefined
63
+
64
+ areOwnPropsEqual ?: (
65
+ nextOwnProps : TOwnProps ,
66
+ prevOwnProps : TOwnProps
67
+ ) => boolean
68
+
69
+ areStatePropsEqual ?: (
70
+ nextStateProps : TStateProps ,
71
+ prevStateProps : TStateProps
72
+ ) => boolean
73
+ areMergedPropsEqual ?: (
74
+ nextMergedProps : TMergedProps ,
75
+ prevMergedProps : TMergedProps
76
+ ) => boolean
77
+ forwardRef ?: boolean | undefined
78
+ }
79
+
53
80
// createConnect with default args builds the 'official' connect behavior. Calling it with
54
81
// different options opens up some testing and extensibility scenarios
55
82
export function createConnect ( {
@@ -70,7 +97,7 @@ export function createConnect({
70
97
areStatePropsEqual = shallowEqual ,
71
98
areMergedPropsEqual = shallowEqual ,
72
99
...extraOptions
73
- } = { }
100
+ } : ConnectOptions = { }
74
101
) {
75
102
const initMapStateToProps = match (
76
103
mapStateToProps ,
0 commit comments