Is it possible to get names of Union's possible types?
Given that I have defined these interfaces and type aliases:
// https://basarat.gitbook.io/typescript/type-system/discriminated-unions
interface Square {
kind: "square";
size: number;
}
interface Rectangle {
kind: "rectangle";
width: number;
height: number;
}
type Shape = Square | Rectangle;
Can I get a union of string like this?
type ShapeName = 'Square' | 'Rectangle';