none
@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 Parameter | Description |
---|---|
| The type of the absent value. |
Returns
Option
<T
>
Example
const x = none<number>();
expect(x.isNone()).toBe(true);
expect(() => x.expect("x is `None`")).toThrow("x is `None`");