Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Result

This is result type.

CAUTION:

Be careful to use === or Object.is() to compare the equality of this type

You should use equal operator to check the equality for two objects of this type instead of === or Object.is(). Operators for this type sometimes return the inputted object directly to avoid an unnecessary objecti allocation.

We use this design by the assumption that we would not compare a and b usually in the following case. It usually suggest some design problems if you would like to compare these a and b.

const a = createOk(val);
const b = andThen(a, someOperation);
type Result<T, E> = Ok<T> | Err<E>;

§Type Parameters

§Type

§
Ok<T> | Err<E>
[src]