Typescript Array Get Last Element From Array To Hashmap