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

Some

This type contain some value of T.

You can create this type value and get an inner value in this type by hand. But we recommend to use factory and utility functions for forward compatibility. And we don't recommend to implement this type for your type too.

  • {@link createSome()} to create a value of Some(T).
  • {@link isSome()} to check whether the value is Some(T).
  • {@link unwrapSome()} to get an inner value in Some(T).
  • unwrapOr() to get either an inner value in Some(T) or a fallback default value.
  • ...and more.
interface Some <T> {
readonly ok: true;
readonly val: T;
}

§Type Parameters

§Properties

§
readonly ok: true
[src]

Don't touch this property directly from an user project except 3rd party project that does not install this package but uses a value returned from an other project. Instead, use {@link isSome()} or {@link isNone()} operator to get an inner value.

Historically, this type was created to target a JSVM that supports ES5. Then there was no well optimized Symbol to achieve a private property. We don't have a plan to change this into private property keep the backward compatibility.

§
readonly val: T
[src]

Don't touch this property directly from an user project except 3rd party project that does not install this package but uses a value returned from an other project. Instead, use {@link unwrapSome()} operator to get an inner value.

Historically, this type was created to target a JSVM that supports ES5. Then there was no well optimized Symbol to achieve a private property. We don't have a plan to change this into private property keep the backward compatibility.