Function isSome

  • Type guard to check if an Option is a Some value. This function is used to narrow down the type of an Option to SomeOption in TypeScript's type system.

    Type Parameters

    • T extends NonUndefined

    Parameters

    • val: Option<T>

      The Option to be checked.

    Returns val is SomeOption<T>

    true if the provided Option is a SomeOption, false otherwise.

    const option = Some('Success');
    if (isSome(option)) {
    console.log('Option has a value:', option.unwrap());
    }

    Use Option.isSome instead.