Typescript Last Index Of Function