const moveArrayItem = < T > ( array , fromIndex , toIndex ) : T [ ] => { const newArray = array . slice ( ) ; newArray . splice ( toIndex , 0 , ... newArray . splice ( fromIndex , 1 ) ) ; return newArray ; } ; export { moveArrayItem } ;