For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /api/functions/Option.isOption.md.

Function: isOption()

isOption<T>(option): option is Option<T>

Type guard to check if a value is an Option.

Type Parameters

T

T extends NonNullableValue

The type of the value.

Parameters

option

unknown

The value to check.

Returns

option is Option<T>

true if the value is an Option, otherwise false.

Example

import { 
import Option
Option
} from 'byenull';
const
const value: unknown
value
: unknown = {
type: string
type
: 'Some',
value: number
value
: 42 };
if (
import Option
Option
.
function isOption<number>(option: unknown): option is Option.Option<number>

Type guard to check if a value is an Option .

@typeParamT - The type of the value.@paramoption - The value to check.@returnstrue if the value is an Option, otherwise false.@example
import { Option } from 'byenull';

const value: unknown = { type: 'Some', value: 42 };

if (Option.isOption<number>(value)) {
  // value is Option<number>
}
@categoryType Guards
isOption
<number>(
const value: unknown
value
)) {
// value is Option<number> }