Typescript Change Last Element Of An Array