Union type as key in interface?
You can use an object type instead of an interface, which are mostly interchangeable:
type IMargin = {
[key in 'foo' | 'bar']: boolean;
}
This is not necessarily an answer, but I think this may interest others.
You can use a Union Type as a key in a sub-property of an Interface.
export type Language = 'EN' | 'DE' | 'IT';
export interface Document {
generic: string;
languages: {
[key in Language]: string[];
}
}