Documentation
    Preparing search index...

    Variable Option

    Option: {
        isSome: <T>(
            option: Option<T>,
        ) => option is { value: T; toString(): never };
        None: <T>() => Option<T>;
        unwrap: <T>(option: Option<T>) => T;
        unwrapOr: <T>(option: Option<T>, defaultValue?: T) => undefined | T;
        unwrapOrThrow: <T>(option: Option<T>, error: Error) => T;
        Value: <T>(value: T) => Option<T>;
    }

    Type declaration

    • isSome: <T>(option: Option<T>) => option is { value: T; toString(): never }

      Check if an Option contains a value.

    • None: <T>() => Option<T>

      Create an Option that contains no value.

    • unwrap: <T>(option: Option<T>) => T

      Unwrap an Option, throwing an error if it is None.

      TypeError if the Option is None.

    • unwrapOr: <T>(option: Option<T>, defaultValue?: T) => undefined | T

      Unwrap an Option, returning a default value if it is None.

    • unwrapOrThrow: <T>(option: Option<T>, error: Error) => T

      Unwrap an Option, throwing the provided error if it is None.

      The provided error if the Option is None.

    • Value: <T>(value: T) => Option<T>

      Create an Option that contains a value.