News for hackers. Stuff that matters.
Re:Elegant Error Handling with the JavaScript “Either” Monad by lacampbell on Wednesday June 19, 2019 @06:43PM (#20228088)
Plus, JS/TS already have proper union types without a need for a construct like Either.

I disagree - what if on success it returns a string representing some data, and on failure it returns a string detailing the error? A `string | string` return type is not very useful, while an `Either<string, string>` is IMO.

Re:Elegant Error Handling with the JavaScript “Either” Monad by boubiyeah on Saturday June 22, 2019 @04:07PM (#20251471)
But that's the simplest union type.

You could have:

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