API reference / @evolu/common / Result
Result
Utilities
| Type Alias | Description |
|---|---|
| InferErr | Extracts the error type from a Result. |
| InferOk | Extracts the value type from a Result. |
Other
| Name | Description |
|---|---|
| Err | An error Result. |
| Ok | A successful Result. |
| Result | 🛡️ Type-safe errors |
| err | Creates an Err result. |
| getOrNull | Extracts the value from a Result if it is an Ok, or returns null if it is an Err. |
| getOrThrow | Extracts the value from a Result if it is an Ok, or throws an error if it is an Err. |
| ok | Creates an Ok result. |
| tryAsync | Wraps async functions or any operation returning a promise, returning a Result. |
| trySync | Wraps synchronous functions that may throw exceptions, returning a Result. |