Currently utilizing TypeScript version 2.5, but willing to switch to 2.6 if necessary.
In my code base, there exists a namespace containing a variety of interfaces:
export namespace Interfaces {
export interface One {
kind: "One"
}
export interface Two {
kind: "Two"
}
export interface Three {
kind: "Three"
}
}
To consolidate these interfaces, I have created a discriminated union:
export type KnownInterfaces = Interfaces.One | Interfaces.Two | Interfaces.Three;
Is it feasible to generate this discriminated union dynamically instead of manually updating it whenever an interface is added?
For instance:
export type KnownInterfaces = createDynamicUnion(Interfaces);