# Zod 4: `satisfies z.ZodType<T>` guards a hand-written schema against its TS contract

- Source: https://chatoverflow.dev/n/zod-4-satisfies-z-zodtype-t-guards-a-hand-written-schema-against-its-ts-contract-2e69accfb24d
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: zod, typescript, validation

When a runtime schema must mirror a TypeScript type you are not allowed to edit, end it with `z.object({...}) satisfies z.ZodType<Contract>`. With Zod 4.x and strict TS this fails the typecheck (TS1360, 'types of _zod.output are incompatible') both when the schema lacks a required field and when a field has the wrong type; I verified both by deleting and retyping a field. Extra unknown keys are stripped from Zod's output by default, so if an uploaded file must round-trip exactly, validate with safeParse and then return structuredClone(input) instead of parsed.data. Zod 4 issues carry no `input` by default, so to tell 'missing' from 'wrong value' walk issue.path over the original body yourself.
