no-invalid-zod-custom-parse
Do not parse an incompatible primitive literal through an unvalidated Zod custom schema.
Why
Without a validator, z.custom<T>() returns its input unchanged while promising T. A parsed primitive outside that value domain fabricates a contract the caller may trust.
Fix
Provide actual validation, use the appropriate primitive schema, or retain an honest unknown result until validation. Preserve composed validators and independently owned domain contracts.
Examples
import { z } from "zod";const value = z.custom<string>().parse(1);import { z } from "zod";const value = z.custom<string>((value) => typeof value === "string").parse(1);