I want to define types the following way:
export type SequenceNode<
T extends ComponentSequenceNode = ComponentSequenceNode,
U extends ContainerSequenceNode = ContainerSequenceNode
> = T | U;
export interface ComponentSequenceNode<T extends SequenceNode = SequenceNode> {
id: string;
node: "sequence";
sequence: "component";
next: T[];
}
export interface ContainerSequenceNode<T extends SequenceNode = SequenceNode> {
id: string;
node: "sequence";
sequence: "container";
next: T[];
into: T[];
}
However, I get a message saying that I have a circular default with these types.
I want to define the types using generics and using this structure but I don’t know how to achieve it.