Closed
Description
I believe this bug was introduced in v1.0.0-beta.3. When wrapping a transform schema in v.optional
with a default value, the inferred output type is now a union including the type of the default value. However, at runtime the default value is still parsed through the transform schema.
Tricky to explain, so here is a playground example.
The schema will always return a number
, but now TypeScript says it will return number | "10"