Skip to content

opt

opt<T>(inner): TypeWrapper<T extends TypeWrapper<U> ? U : T>

Defined in: .work/repos/edinburgh/src/types.ts:753

Create an optional type wrapper (allows undefined).

T extends TypeWrapper<unknown> | BasicType

Type wrapper or basic type to make optional.

T

The inner type to make optional.

TypeWrapper<T extends TypeWrapper<U> ? U : T>

A union type that accepts the inner type or undefined.

const optionalString = E.opt(E.string);
const optionalNumber = E.opt(E.number);