import { AlertInstanceContext , AlertInstanceState } from '../types' ; import { AlertInstance } from './alert_instance' ; export function createAlertInstanceFactory < InstanceState extends AlertInstanceState , InstanceContext extends AlertInstanceContext , ActionGroupIds extends string > ( alertInstances ) { return ( id ) : AlertInstance < InstanceState , InstanceContext , ActionGroupIds > => { if ( ! alertInstances [ id ] ) { alertInstances [ id ] = new AlertInstance < InstanceState , InstanceContext , ActionGroupIds > ( ) ; } return alertInstances [ id ] ; } ; }