Skip to content

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 ParameterDefault typeDescription
T-The type of the value, when successful
EunknownThe 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