Skip to main content

none

@ts-rust/std


@ts-rust/std / Option / none

Function: none()

function none<T>(): Option<T>;

Defined in: packages/std/src/option/option.ts:64

Creates a None variant of an Option, representing the absence of a value.

Produces an option indicating no value is present.

Type Parameters

Type ParameterDescription

T

The type of the absent value.

Returns

Option<T>

An Option representing None.

Example

const x = none<number>();

expect(x.isNone()).toBe(true);
expect(() => x.expect("x is `None`")).toThrow("x is `None`");