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.isNone.md.

Function: isNone()

isNone<O>(option): option is Extract<O, None>

Type guard to check if an Option is a None.

Type Parameters

O

O extends Option<unknown>

The Option type to check.

Parameters

option

O

The Option to check.

Returns

option is Extract<O, None>

true if the option is a None, otherwise false.

Example

import { 
import Option
Option
} from 'byenull';
declare const
const option: Option.Option<number>
option
:
import Option
Option
.
type Option<T> = Option.Some<T> | Option.None

A union type representing either a Some or a None .

@typeParamT - The type of the Some value.@example
import { Option } from 'byenull';

const doSomething = (): Option.Option<number> => {
  return Math.random() > 0.5
    ? Option.some(10)
    : Option.none();
};
@categoryCore Types
Option
<number>;
if (
import Option
Option
.
function isNone<Option.Option<number>>(option: Option.Option<number>): option is Option.None

Type guard to check if an Option is a None .

@typeParamO - The Option type to check.@paramoption - The Option to check.@returnstrue if the option is a None, otherwise false.@example
import { Option } from 'byenull';

declare const option: Option.Option<number>;

if (Option.isNone(option)) {
  console.log('No value present');
}
@categoryType Guards
isNone
(
const option: Option.Option<number>
option
)) {
var console: Console
console
.
Console.log(...data: any[]): void

The console.log() static method outputs a message to the console.

MDN Reference

log
('No value present');
}