Closed val-o closed 3 years ago
Would MakeAdtMember
work?
import { MakeADTMember } from 'ts-adt/MakeADT';
type Either = { _type: 'left'; value1: number } | { _type: 'Right'; value2: string }
type leftside = MakeADTMember<'_type', Either, 'left'> // leftside = { _type: 'Left'; value1: number; }
type leftval = leftside['value1'] // leftval = number
Thanks, thats exatly what I need
Hi people, I couldn't find something to infer union member.
Can we make some helper for it so we could use it like this