Convert Option<T>
to T | undefined
value
const x: string | undefined = 'foo';
assert.deepEqual(Option.fromUndefinable(x), Some('foo'));
const y: string | undefined = undefined;
assert.deepEqual(Option.fromUndefinable(y), None);
const z = 'bar';
assert.deepEqual(Option.fromUndefinable(z), Some('bar'));
This is not in Rust.
Convert Option<T>
to T | null
value
const x: string | null = 'foo';
assert.deepEqual(Option.fromNullable(x), Some('foo'));
const y: string | null = null;
assert.deepEqual(Option.fromNullable(y), None);
const z = 'bar';
assert.deepEqual(Option.fromNullable(z), Some('bar'));
This is not in Rust.
Generated using TypeDoc
The Option type. See the module level documentation for more.
In Rust