import { Action } from 'redux' ; import { BasicActionCreator , PayloadActionCreator } from './types' ; param type returns export default function createAction < T extends string | symbol | number > ( type ) { const actionCreator = ( ) => ( { type } ) ; return Object . assign ( actionCreator , { type , matches ( a ) { return a . type == type ; } , withPayload < P > ( ) { const payloadActionCreator = ( payload ) => ( { type , payload , } ) ; return Object . assign ( payloadActionCreator , { type , matches : this . matches as any , } ) ; } , } ) ; }