Typescript typed Map
You can declare the array passed into the constructor as const so it doesn't get widened to Array&lt;[string, number]&gt;, and use generics to look up the key on the constructed map to get the AvatarSize type:
const sizes = new Map([
    [&quot;xs&quot;, 32],
    [&quot;sm&quot;, 44],
    [&quot;md&quot;, 104]
] as const);
export type AvatarSize = Parameters&lt;typeof sizes.get&gt;[0];

Another way of doing it would be to declare the array outside:
const sizesArr = [
    [&quot;xs&quot;, 32],
    [&quot;sm&quot;, 44],
    [&quot;md&quot;, 104]
] as const;
const sizes = new Map(sizesArr);
export type AvatarSize = (typeof sizesArr)[number][0];