API reference / @backpack/error-handling / result / Result
Interface: Result<T, E>
Represents either a Success (with a value) or a Failure (with an error).
Type Parameters
Type Parameter | Default type | Description |
---|---|---|
T | - | The type of the value, when successful |
E | unknown | The type of the error, when failed |
Properties
error?
ts
optional error: E;
If Failure, contains the error
failed
ts
failed: boolean;
False if Success, true if Failure
success
ts
success: boolean;
True if Success, false if Failure
value?
ts
optional value: T;
If Success, contains the value