FuncType - v0.8.64
    Preparing search index...

    Variable Option

    Option: {
        from<T>(value: T): Option<T>;
        none<T>(): Option<T>;
        <T extends unknown>(value: undefined | null | T): Option<T>;
    }

    Safely wraps a value that might be null or undefined in an Option. Creates Some if the value is defined, None otherwise.

    Type declaration

      • <T extends unknown>(value: undefined | null | T): Option<T>
      • Type Parameters

        • T extends unknown

          The type of the value

        Parameters

        • value: undefined | null | T

          The value to wrap (might be null/undefined)

        Returns Option<T>

        Some(value) if value is defined, None otherwise

    • from: function
      • Creates an Option from any value. Alias for Option function.

        Type Parameters

        • T

          The type of the value

        Parameters

        • value: T

          The value to wrap

        Returns Option<T>

        Some(value) if value is defined, None otherwise

    • none: function
      • Returns a None instance. Alias for None function.

        Type Parameters

        • T

          The type that would be contained if this was a Some

        Returns Option<T>

        A None instance