no-zod-parse-typed-object
Reuse known object contracts instead of parsing them again with Zod.
Why
Parsing a typed service result duplicates its object contract and adds runtime validation and copying throughout trusted application code. Validate unknown data once at its boundary.
Fix
Use the typed value directly. If defaults or normalization are needed, express that mapping explicitly. Keep untrusted boundary data unknown until it is validated.
Examples
import { z } from "zod";const RowSchema = z.object({ id: z.string() });declare function load(): Promise<{ id: string }>;export async function read() { return RowSchema.parse(await load());}import { z } from "zod";const RowSchema = z.object({ id: z.string() });export function read(raw: unknown) { return RowSchema.parse(raw);}