opt
opt<
T>(inner):TypeWrapper<TextendsTypeWrapper<U> ?U:T>
Defined in: .work/repos/edinburgh/src/types.ts:753
Create an optional type wrapper (allows undefined).
Type Parameters
Section titled “Type Parameters”T extends TypeWrapper<unknown> | BasicType
Type wrapper or basic type to make optional.
Parameters
Section titled “Parameters”T
The inner type to make optional.
Returns
Section titled “Returns”TypeWrapper<T extends TypeWrapper<U> ? U : T>
A union type that accepts the inner type or undefined.
Example
Section titled “Example”const optionalString = E.opt(E.string);const optionalNumber = E.opt(E.number);