import { RemoveArrayControlAction } from '../actions' ; import { formArrayReducer } from '../array/reducer' ; import { FormArrayState , isArrayState } from '../state' ; import { ensureState } from './util' ; /**
 * This update function takes an index and returns a projection function
 * that removes the child control at the given index from a form array state.
 */ export function removeArrayControl ( index ) ; /**
 * This update function takes an array form state and an index and removes the
 * child control at the given index from the state.
 */ export function removeArrayControl < TValue > ( state , index ) ; export function removeArrayControl < TValue > ( indexOrState , index ? ) { if ( isArrayState ( indexOrState ) ) { return formArrayReducer ( indexOrState , new RemoveArrayControlAction ( indexOrState . id , index ! ) ) ; } return ( s ) => removeArrayControl ( ensureState ( s ) , indexOrState as number ) ; }