|
1 | 1 | import type { Dispatch, Action } from 'redux'
|
| 2 | +import type { ComponentType } from 'react' |
2 | 3 | import verifySubselectors from './verifySubselectors'
|
3 | 4 | import type { EqualityFn } from '../types'
|
4 | 5 |
|
@@ -58,10 +59,9 @@ export type MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps> = (
|
58 | 59 | ) => TMergedProps
|
59 | 60 |
|
60 | 61 | interface PureSelectorFactoryComparisonOptions<TStateProps, TOwnProps, State> {
|
61 |
| - areStatesEqual: EqualityFn<State> |
62 |
| - areOwnPropsEqual: EqualityFn<TOwnProps> |
63 |
| - areStatePropsEqual: EqualityFn<TStateProps> |
64 |
| - displayName: string |
| 62 | + readonly areStatesEqual: EqualityFn<State> |
| 63 | + readonly areStatePropsEqual: EqualityFn<TStateProps> |
| 64 | + readonly areOwnPropsEqual: EqualityFn<TOwnProps> |
65 | 65 | }
|
66 | 66 |
|
67 | 67 | export function pureFinalPropsSelectorFactory<
|
@@ -162,24 +162,33 @@ interface WrappedMapDispatchToProps<TDispatchProps, TOwnProps> {
|
162 | 162 | readonly dependsOnOwnProps: boolean
|
163 | 163 | }
|
164 | 164 |
|
| 165 | +export interface InitOptions<TStateProps, TOwnProps, TMergedProps, State> |
| 166 | + extends PureSelectorFactoryComparisonOptions<TStateProps, TOwnProps, State> { |
| 167 | + readonly shouldHandleStateChanges: boolean |
| 168 | + readonly displayName: string |
| 169 | + readonly wrappedComponentName: string |
| 170 | + readonly WrappedComponent: ComponentType<TOwnProps> |
| 171 | + readonly areMergedPropsEqual: EqualityFn<TMergedProps> |
| 172 | +} |
| 173 | + |
165 | 174 | export interface SelectorFactoryOptions<
|
166 | 175 | TStateProps,
|
167 | 176 | TOwnProps,
|
168 | 177 | TDispatchProps,
|
169 | 178 | TMergedProps,
|
170 | 179 | State
|
171 |
| -> extends PureSelectorFactoryComparisonOptions<TStateProps, TOwnProps, State> { |
172 |
| - initMapStateToProps: ( |
173 |
| - dispatch: Dispatch, |
174 |
| - options: PureSelectorFactoryComparisonOptions<TStateProps, TOwnProps, State> |
| 180 | +> extends InitOptions<TStateProps, TOwnProps, TMergedProps, State> { |
| 181 | + readonly initMapStateToProps: ( |
| 182 | + dispatch: Dispatch<Action<unknown>>, |
| 183 | + options: InitOptions<TStateProps, TOwnProps, TMergedProps, State> |
175 | 184 | ) => WrappedMapStateToProps<TStateProps, TOwnProps, State>
|
176 |
| - initMapDispatchToProps: ( |
177 |
| - dispatch: Dispatch, |
178 |
| - options: PureSelectorFactoryComparisonOptions<TStateProps, TOwnProps, State> |
| 185 | + readonly initMapDispatchToProps: ( |
| 186 | + dispatch: Dispatch<Action<unknown>>, |
| 187 | + options: InitOptions<TStateProps, TOwnProps, TMergedProps, State> |
179 | 188 | ) => WrappedMapDispatchToProps<TDispatchProps, TOwnProps>
|
180 |
| - initMergeProps: ( |
181 |
| - dispatch: Dispatch, |
182 |
| - options: PureSelectorFactoryComparisonOptions<TStateProps, TOwnProps, State> |
| 189 | + readonly initMergeProps: ( |
| 190 | + dispatch: Dispatch<Action<unknown>>, |
| 191 | + options: InitOptions<TStateProps, TOwnProps, TMergedProps, State> |
183 | 192 | ) => MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>
|
184 | 193 | }
|
185 | 194 |
|
|
0 commit comments