Is there a way to extract a specific property of a combined type and generate a new type from it?
Consider the following example:
type Actions =
| {
type: "ADD_COLUMN";
newColumnIndex: number;
column: SelectorColumnData;
}
| {
type: "ITEM_CHECKED";
columnIndex: number;
item: SelectorItem;
};
Is there a clever generic solution that we can utilize to create something like this:
type ActionTypes = GetTypes<Actions>
// ActionTypes = "ADD_COLUMN" | "ITEM_CHECKED"