const KeyToVal = { MyKey1: 'myValue1', MyKey2: 'myValue2', } as const; type Keys = keyof typeof KeyToVal; type Values = typeof KeyToVal[Keys]; // "myValue1" | "myValue2"
const KeyToVal = { MyKey1: 'myValue1', MyKey2: 'myValue2', } as const; type Keys = keyof typeof KeyToVal; type Values = typeof KeyToVal[Keys]; // "myValue1" | "myValue2"