typescript convert record to map