let id = 0 ; export const getId = ( ) : number => { return id ++ ; } ; export const replaceItemAtIndex = < T > ( arr , index , newValue ) : T [ ] => { return [ ... arr . slice ( 0 , index ) , newValue , ... arr . slice ( index + 1 ) ] ; } ; export const removeItemAtIndex = < T > ( arr , index ) : T [ ] => { return [ ... arr . slice ( 0 , index ) , ... arr . slice ( index + 1 ) ] ; } ;