Hacker News new | ask | show | jobs
by boubiyeah 2554 days ago
But that's the simplest union type.

You could have:

type Result = {type: 'ok', value: string} | {type: 'err', value: string}