effect-io-ai

Package: effect
Module: Option

Option.isOption

Determines whether the given value is an Option.

Details

This function checks if a value is an instance of Option. It returns true if the value is either Option.some or Option.none, and false otherwise. This is particularly useful when working with unknown values or when you need to ensure type safety in your code.

Example

import { Option } from "effect"

console.log(Option.isOption(Option.some(1)))
// Output: true

console.log(Option.isOption(Option.none()))
// Output: true

console.log(Option.isOption({}))
// Output: false

Signature

declare const isOption: (input: unknown) => input is Option<unknown>

Source

Since v2.0.0