API reference / @evolu/common / Result

Result

Utilities

Type AliasDescription
InferErrExtracts the error type from a Result.
InferOkExtracts the value type from a Result.

Other

NameDescription
ErrAn error Result.
OkA successful Result.
Result🛡️ Type-safe errors
errCreates an Err result.
getOrNullExtracts the value from a Result if it is an Ok, or returns null if it is an Err.
getOrThrowExtracts the value from a Result if it is an Ok, or throws an error if it is an Err.
okCreates an Ok result.
tryAsyncWraps async functions or any operation returning a promise, returning a Result.
trySyncWraps synchronous functions that may throw exceptions, returning a Result.

Was this page helpful?