import { RemoveGroupControlAction } from '../actions' ; import { formGroupReducer } from '../group/reducer' ; import { FormGroupState , isGroupState , KeyValue } from '../state' ; import { ensureState } from './util' ; /**
 * This update function takes a name and returns a projection function
 * that removes the child control with the given name from a form group state.
 */ export function removeGroupControl < TValue extends KeyValue > ( name ) ; /**
 * This update function takes a group form state and a name and removes the
 * child control with the given name from the state.
 */ export function removeGroupControl < TValue extends KeyValue > ( state , name ) ; export function removeGroupControl < TValue extends KeyValue > ( nameOrState , name ? ) { if ( isGroupState ( nameOrState ) ) { return formGroupReducer ( nameOrState , new RemoveGroupControlAction < TValue > ( nameOrState . id , name ! ) ) ; } return ( s ) => removeGroupControl ( ensureState ( s ) , nameOrState as keyof TValue ) ; }