Function metadata

  • add metadata to a schema

    Type Parameters

    • const T
    • const S
    • const M

    Parameters

    Returns CompiledSchema<T, {
        [K in keyof (S & Record<"metadata", M>)]: (S & Record<"metadata", M>)[K]
    }>

    Example

    const schema = metadata(boolean(), "flag");
    const raw: { type: "boolean", metadata: "flag" } = schema.schema();