Create a Result that contains an error.
The type of the value to not contain.
The type of the error to contain.
Optional
Result
Result.Err('error') // => { ok: false, error: 'error' }Result.Err() // => { ok: false, error: undefined } Copy
Result.Err('error') // => { ok: false, error: 'error' }Result.Err() // => { ok: false, error: undefined }
Check if a Result is an error.
true if the Result is an error, otherwise false.
Check if a Result is OK.
true if the Result is OK, otherwise false.
Check if a Result is an unknown error (error field is undefined).
true if the Result is an unknwon error, otherwise false.
Create a Result that contains a value.
The type of the value to contain.
The type of the error to not contain.
Result.Ok(42) // => { ok: true, value: 42 }Result.Ok() // => { ok: true, value: undefined } Copy
Result.Ok(42) // => { ok: true, value: 42 }Result.Ok() // => { ok: true, value: undefined }
Create a Result that contains an error.