Checks if the assertion passes or if the value is undefined.
const maybeString = optional(string);maybeString(1); // Error: typemaybeString("hello"); // passesmaybeString(undefined); // passes Copy
const maybeString = optional(string);maybeString(1); // Error: typemaybeString("hello"); // passesmaybeString(undefined); // passes
Assertion to be checked.
Checks if the assertion passes or if the value is undefined.
Example