Whether or not this Result is a Cancellation Result
Whether or not this Result is an Error Result. Error Results will always
have a defined value
field containing the error the Result holds
Whether or not this Result is an Ok Result. Does not indicate whether or
not this Result holds a value. Use isSome()
to check that
value
is not undefined/null
Whether or not this Result holds a value
Creates a Cancellation Result. Cancellation Results are used to signal that an operation (Rule, Middleware, Argument prompting, etc) has been cancelled and should exit silently.
NOTE: Rules and Middleware can pass a Cancellation Result to the next
function to exit silently, but they will also exit silently if the next
function is never called, so the Cancellation Result is not really necessary
for them. Cancellation Results are primarily used for Argument defaults to
signal that a command should be canceled (Likely because the Argument default
uses argument prompting and the prompt was canceled).
Creates an Error Result. Must be given an Error. Error Results are used for passing errors from Rules, Middleware, and Argument resolvers so that they can more easily be passed around to error handlers
Creates an Ok Result. Can be given a value. Ok Results represent the result of a successful operation
Generated using TypeDoc
Represents the result of some operation. Can hold a value. Use
isSome()
to check if the result holds a value.Typescript Note:
isSome()
andisError()
both assert that the value field is not able to beundefined
at run-time AND compile-time so you won't need to make any additional checks. 👍