In typescript, how can I create a new type from multiple type declarations in an outer join kind of way ?
I have 2 type declarations
type OverflowPosition = "safe" | "unsafe" | "";
type BaselinePosition = "baseline" | "center";
I would like to see them combined to
type OverflowBaselinePosition = "safe baseline" | "safe center" | "unsafe baseline" | "unsafe center" | "baseline" | "center" ;
>Solution :
You can use template literal types, e.g.
type OverflowPosition = "safe" | "unsafe" | "";
type BaselinePosition = "baseline" | "center";
type CombinedPosition = `${OverflowPosition} ${BaselinePosition}`