Represents the outcome of an operation that may either succeed or fail.
This type is a discriminated union with two possible states:
Success result
{ ok: true, value: T } Copy
{ ok: true, value: T }
Contains the resulting value of type T.
T
Error result
{ ok: false, error: string, type: SDKErrorType } Copy
{ ok: false, error: string, type: SDKErrorType }
Contains an error message and a machine-readable SDKErrorType.
Typical usage:
const result = doThing();if (result.ok) { console.log("Success:", result.value);} else { console.error("Failed:", result.error, "Type:", result.type);} Copy
const result = doThing();if (result.ok) { console.log("Success:", result.value);} else { console.error("Failed:", result.error, "Type:", result.type);}
The type of the successful result value.
Represents the outcome of an operation that may either succeed or fail.
This type is a discriminated union with two possible states:
Success result
Contains the resulting value of type
T.Error result
Contains an error message and a machine-readable SDKErrorType.
Typical usage: