What's the cleanest pattern for discriminated unions with async results?
I keep writing { status: 'loading' } | { status: 'success'; data: T } | { status: 'error'; message: string } by hand. Is there a utility type approach people use to avoid the boilerplate while keeping exhaustiveness checks?
4
0 comments