Is there a way to define a list of permitted values for a property name in an interface?
Let's consider an interface as an example:
export interface DashboardRequest {
name?: string;
description?: string;
type: 'foo' | 'bar';
['foo' | 'bar']: any;
}
I am looking to limit a property name to the possible values of another property within the same interface.
Although the example above is incorrect, it conveys my intended goal.
What is the appropriate approach to achieve this?