Typescript Change Position In Array Function