I have some Set, which defines some IDs:
export const IDS: Set<number> = new Set<number>([1, 30, 50, 9999]);
Now I’d like to define mapping for their ID-SHA pairs in object structure:
export const IdMap: MapType= {
1: '33b87373-cd6c-4c5b-873a-3290f0854a0b',
30: '027c92d7-aab6-4047-82cd-fd5547100505',
50: '3a9b2155-ecfe-4cde-9b9b-0f5c19876705',
9999: 'cc498b4b-64e4-4215-bd55-6c3ce7367922',
};
The goal is to define MapType
to enforce field names to be only from Set defined above. I’ve already tried several exotic constructs like:
type MapType= { [key in keyof typeof IDS]: string };
that looks reasonable, but don’t work at all.
I’d be glad for any further assist