Lets say I have an interface:
// I get this from an external library so I have no control over it
interface Balloon {
diameter: number;
color: "red" | "blue" | "green";
}
And I want to create my own interface that looks like this:
interface Shirt {
size: "m" | "l" | "xl";
color: "red" | "blue" | "green";
}
My question is whether it is possible to 'take' the color part from Balloon and inject it into Shirt, so I get something like this:
interface Shirt {
size: "m" | "l" | "xl";
color: Balloon.color; // I know this is wrong but it is to illustrate what I want to achieve
}
color: Balloon['color']