Typescript Infer Type From Array To Hashmap In Python