I would like to do:
type PossibleKeys = 'a' | 'b' | 'c'
... and now I would like to create a type which the key has to be necessarily one of the above. Like:
type MyType = {
a: number;
b: string;
c: boolean;
d: {} // <--- I want it not to be allowed because `d` does not extend `PossibleKeys`
}
How would you do that?
PossibleKeys.type MyType = Record<PossibleKeys, unknown>