Change8
Error1 reports

Fix PickOnlyUnexpectedKeysDoesCorrectlyError

in Zod

Solution

This error usually arises when the `pick` method on Zod objects doesn't properly enforce key constraints at compile time, allowing unexpected keys to slip through. To fix it, ensure the `pick` method's return type accurately reflects the picked schema and introduce a type-level check that explicitly verifies the provided keys in the `pick` call are valid for the original Zod object schema, throwing a TypeScript error otherwise. This will re-establish compile-time safety.

Related Issues

Real GitHub issues where developers encountered this error:

Timeline

First reported:Oct 8, 2025
Last reported:Oct 8, 2025

Need More Help?

View the full changelog and migration guides for Zod

View Zod Changelog