Let's consider a scenario where I have the following type (purely for illustrative purposes):
type Alignment =
"top left" |
"middle left" |
"bottom left" |
"top center" |
"middle center" |
"bottom center" |
"top right" |
"middle right" |
"bottom right";
Would it be feasible to implement something like this instead?
type Vertical = "top" | "middle" | "bottom";
type Horizontal = "left" | "center" | "right";
type Alignment = `${Vertical} ${Horizontal}`;
UPDATE Upon further reflection, seems like my initial query was off-topic and not related to TypeScript after all. Apologies for the confusion, but thank you for the responses, they were really helpful.
However, I'm encountering this error in VSCode, any solutions?