The value contained in an Error instance of the Result structure.
The value contained in an Error instance of the Result structure.
This is usually used to destructure the instance in a .matchWith
call.
const Result = require('folktale/result');
Result.Error(1).matchWith({
Error: ({ value }) => value, // equivalent to (x) => x.value
Ok: ({ value }) => 'nothing'
});
// ==> 1
get value() {
throw new TypeError('`value` can’t be accessed in an abstract instance of Result.Error');
}