Typescript Index Last Element Of Array Python