I have a requirement:
type AllowedKeys = 'a' | 'b' | 'c'
... and now I want to define a type where the key has to be one of the values in AllowedKeys. For example:
type MyType = {
a: number;
b: string;
c: boolean;
d: {} // <--- I want to restrict this because `d` is not in AllowedKeys
}
How can this be implemented?