Validator type
What validate() and validated() accept for a single value: a Zod schema, a validatable() class whose own field schemas should be used, or null/undefined to skip validation at that position.
Signature:
export type Validator = ZodType | Ctor | null | undefined;
References: Ctor
Remarks
A class is resolved through schemaOf() at the moment it is first needed rather than when the decorator runs. That defers the cost, not the reference: the class still has to be declared above the decorator that names it, which both the compiler and the temporal dead zone enforce, so two input classes cannot be made to reference each other.
A class that was never sealed with validatable() resolves to null, and the value it was meant to guard is then left unvalidated with no error raised — see validate() for why that mistake usually shows up somewhere else entirely.
Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.