@@ -269,6 +269,40 @@ function MapStateAndDispatchObject() {
269
269
const verify = < Test foo = "bar" />
270
270
}
271
271
272
+ function MapStateAndNullishDispatch ( ) {
273
+ interface ClickPayload {
274
+ count : number
275
+ }
276
+ const onClick : ActionCreator < ClickPayload > = ( ) => ( { count : 1 } )
277
+ const dispatchToProps = {
278
+ onClick,
279
+ }
280
+
281
+ interface OwnProps {
282
+ foo : string
283
+ }
284
+ interface StateProps {
285
+ bar : number
286
+ }
287
+
288
+ const mapStateToProps = ( _ : any , __ : OwnProps ) : StateProps => ( {
289
+ bar : 1 ,
290
+ } )
291
+
292
+ class TestComponent extends React . Component < OwnProps & StateProps > { }
293
+
294
+ const TestDispatchPropsNull = connect ( mapStateToProps , null ) ( TestComponent )
295
+
296
+ const verifyNull = < TestDispatchPropsNull foo = "bar" />
297
+
298
+ const TestDispatchPropsUndefined = connect (
299
+ mapStateToProps ,
300
+ undefined
301
+ ) ( TestComponent )
302
+
303
+ const verifyNonUn = < TestDispatchPropsUndefined foo = "bar" />
304
+ }
305
+
272
306
function MapDispatchFactory ( ) {
273
307
interface OwnProps {
274
308
foo : string
@@ -422,6 +456,33 @@ function MapStateAndDispatchAndMerge() {
422
456
const verify = < Test foo = "bar" />
423
457
}
424
458
459
+ function MapStateAndMerge ( ) {
460
+ interface OwnProps {
461
+ foo : string
462
+ }
463
+ interface StateProps {
464
+ bar : number
465
+ }
466
+ interface DispatchProps {
467
+ onClick : ( ) => void
468
+ }
469
+
470
+ class TestComponent extends React . Component < OwnProps & StateProps > { }
471
+
472
+ const mapStateToProps = ( ) => ( {
473
+ bar : 1 ,
474
+ } )
475
+
476
+ const mergeProps = ( stateProps : StateProps , _ : null , ownProps : OwnProps ) => ( {
477
+ ...stateProps ,
478
+ ...ownProps ,
479
+ } )
480
+
481
+ const Test = connect ( mapStateToProps , null , mergeProps ) ( TestComponent )
482
+
483
+ const verify = < Test foo = "bar" />
484
+ }
485
+
425
486
function MapStateAndOptions ( ) {
426
487
interface State {
427
488
state : string
0 commit comments