Skip to content
GitHub

ValidatePipes

type alias in meocord/interface Since 4.1.0

type ValidatePipes<S extends StandardSchemaV1> = {
  [K in keyof InferSchemaOutput<S>]?:
    ValidatePipeEntry | readonly ValidatePipeEntry[]
}

The pipes @Validate takes for a schema: some of the schema's output keys, each with one pipe or several applied in order.

Use it to type a decorator of your own that wraps @Validate, so the pipes it passes on are checked against the schema as @Validate checks them.

Examples

TypeScript
const Checked = <S extends StandardSchemaV1, const P extends ValidatePipes<S> = Record<never, never>>(
  schema: S,
  options?: ValidateOptions<P>,
) => Validate(schema, options)

See also