Open kerwanp opened 1 year ago
What would be the advantages over doing & { type: 'title' }
(or & { type: 'title' | 'number' }
on the desired type?
This can be done in plain typescript:
type T2 = Extract<T1, { 'type': 'title' }>
type T3 = Extract<T1, { 'type': 'file' }>
type T4 = Extract<T1, { 'type': 'title' | 'file' }>
Proposal
Adding a utility type for discriminated unions to select specific types using discriminator value.
Example:
Upvote & Fund