• Augment a struct to allow exact-optional values. Exact-optional values can be omitted but cannot be undefined.

    const foo = object({ bar: exactOptional(string()) });
    type Foo = Infer<typeof foo>;
    // Foo = { bar?: string }

    Type Parameters

    • Type
    • Schema

    Parameters

    • struct: Struct<Type, Schema>

      The struct to augment.

    Returns Struct<Type | ExactOptionalTag, Schema>

    The augmented struct.