Array field get inferred as type never[]
When passing the empty array as a default value to an array field, it gets inferred as never[] instead of the type inferred from zod schema. And in general, it gets inferred as the type of whatever I pass to default value.
Is this intended behavior?
3 Replies
equal-aqua•10mo ago
Open a bug and please include a minimal reproduction and we'll take a look
wise-whiteOP•10mo ago
just to make sure, since I think this is a part of a larger issue - the types don't get inferred from zod schema at all, since if I remove the type cast in default values I can pass anything I want and it will be inferred as the type of that object instead of the zod schema shape
wise-whiteOP•9mo ago
GitHub
Form field types don't get inferred from zod schema · Issue #1066 ·...
Describe the bug Without type casting the default values, the form type gets inferred as ReactFormExtendedApi<TYPE, Validator<unknown, z.ZodType<any, z.ZodTypeDef, any>>> where TY...