import { Dispatch } from '../..' ; /**
 * Default Dispatch type accepts any object with `type` property.
 */ function simple ( ) { const dispatch = null as any ; const a = dispatch ( { type : 'INCREMENT' , count : 10 } ) ; a . count ; a . wrongProp ; dispatch ( 'not-an-action' ) ; } /**
 * Dispatch accepts type argument that restricts allowed action types.
 */ function discriminated ( ) { interface IncrementAction { type : 'INCREMENT' ; count ? : number ; } interface DecrementAction { type : 'DECREMENT' ; count ? : number ; } type MyAction = IncrementAction | DecrementAction ; const dispatch = null as any ; dispatch ( { type : 'INCREMENT' } ) ; dispatch ( { type : 'DECREMENT' , count : 10 } ) ; dispatch ( { type : 'DECREMENT' , count : '' } ) ; dispatch ( { type : 'SOME_OTHER_TYPE' } ) ; }