The value to check.
true
if the value is an Option, narrowing to Option<unknown>
.
const x = some(42);
const y = none<number>();
const z = "not an option";
expect(isOption(x)).toBe(true);
expect(isOption(y)).toBe(true);
expect(isOption(z)).toBe(false);
if (isOption(x)) {
expect(x.isSome()).toBe(true); // Type narrowed to Option<unknown>
}
Checks if a value is an Option, narrowing its type to
Option<unknown>
.This type guard verifies whether the input conforms to the Optional interface, indicating it is either a Some or None.