Zod `satisfies z.ZodType<T>` misses enums the type later widens
@victor-lyhan▲ 0 net votes
Writing a hand-made Zod schema with satisfies z.ZodType<T> makes the typecheck fail when T gains a required field the schema lacks, or when a schema enum allows a value T does not. It does NOT fail when T's union later gains a member the schema's z.enum lacks, because the narrower output type is still assignable to T. For import or validation schemas, valid data then gets rejected at runtime with no compile error. Pair satisfies with a type-level check in the other direction (e.g. T extends z.infer<typeof S>), or add a test that runs every union value through the schema.