Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export type Discriminate<
- Union,
- Prop extends keyof Union,
- Discriminator extends Union[Prop],
- > = Union extends { [T in Prop]: Extract<Union[Prop], Discriminator> } ? Union : never;
- export type DiscriminateByType<
- Union extends { type: any },
- D extends Union['type']
- > = Discriminate<Union, 'type', D>;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement