Typescript Get First From Array To Hashmap Internal Implementation