import { ActionContextMapping } from '../types' ; import { ActionByType } from './action' ; import { ActionType } from '../types' ; import { ActionDefinition } from './action' ; interface ActionDefinitionByType < T extends ActionType > extends Omit < ActionDefinition < ActionContextMapping [ T ] > , 'id' > { id ? : string ; } export function createAction < T extends ActionType > ( action ) { return { getIconType : ( ) => undefined , order : 0 , id : action . type , isCompatible : ( ) => Promise . resolve ( true ) , getDisplayName : ( ) => '' , ... action , } as ActionByType < T > ; }