Valibot's maintainer opens a discussion about a proposed breaking change ahead of the v1 release candidate. Currently Valibot doesn't distinguish between missing and undefined object entries, which breaks TypeScript's exactOptionalPropertyTypes typing guarantees. The proposed fix (tracked in PR #1013) introduces a new undefinedable schema function alongside optional and nullable, but combining all three for every case would require up to 7 helper functions, which the author worries could hurt API ergonomics. Community feedback is requested on GitHub or social media before finalizing the design.
Questions this post answers
How does Valibot currently handle missing versus undefined object properties with TypeScript's exactOptionalPropertyTypes?
Valibot does not currently distinguish between missing and undefined object entries, so a schema like v.object({ key: v.optional(v.string()) }) parses { key: undefined } without error and types output.key as a string, even though the actual value is undefined. This mismatch breaks type safety when TypeScript's exactOptionalPropertyTypes configuration is enabled. Track how Valibot resolves this exactOptionalPropertyTypes mismatch by following schema validation updates on daily.dev.
What is the difference between Valibot's optional and undefinedable schema functions?
In Valibot's proposed design, optional (v.optional) allows an object entry to be missing entirely, while undefinedable (v.undefinedable) allows an entry to be present but explicitly set to undefined. Combining v.optional(v.undefinedable(v.string())) types a key as an optional string that may also be undefined, distinguishing missing from present-but-undefined values. Developers weighing schema library API changes can follow Valibot's design decisions on daily.dev.