Closed joelgrus closed 1 year ago
better way:
function unpack(res: Result<Option<string>, Error>): Result<string, Error> {
return res.map((opt) => match(opt,
{
Some: (s) => s,
None: () => { throw new Error('not found') }
}))
it seems like the following should work?
but it results in an error
am I doing something wrong? or is there a better way to accomplish this sort of thing?