You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have been doing some experiments with this form and have come across this problem:
When I use only 1 level of fields, without any z.object in my schema, the autocomplete and type validation for fieldConfig works fine, but when I use some nested fields and objects in my schema, the autocompletion is lost.
Consider this schema:
`z.object({
group1: z.object({
username: z.string({
required_error: 'Username is required.',
}),
password: z.string({
required_error: 'Password is required.',
}),
}),
});`
If I now try to put set some irrelevant property to fieldConfig, there is no warning:
The expected behavior would be to throw a type error, as in the flat schema case:
Is it because typescript is not able to correctly resolve the recursion type to FieldConfigItem ?
Also, I was wondering what approach you would recommend for extending the configuration options for the objects. I would like to be able to choose from more rendering components than just Accordion, but am not sure what is the best path to take. The best solution would be something type-safe.
Anyway, thanks for this great idea of schema based form !
The text was updated successfully, but these errors were encountered:
I've also noticed this problem while creating the examples. In the type declarations, nested objects should be typed too but it looks like the declaration is wrong somewhere.
Hi, I have been doing some experiments with this form and have come across this problem:
When I use only 1 level of fields, without any z.object in my schema, the autocomplete and type validation for fieldConfig works fine, but when I use some nested fields and objects in my schema, the autocompletion is lost.
Consider this schema:
`z.object({
group1: z.object({
username: z.string({
required_error: 'Username is required.',
}),
});`
If I now try to put set some irrelevant property to fieldConfig, there is no warning:
The expected behavior would be to throw a type error, as in the flat schema case:
Is it because typescript is not able to correctly resolve the recursion type to FieldConfigItem ?
Also, I was wondering what approach you would recommend for extending the configuration options for the objects. I would like to be able to choose from more rendering components than just Accordion, but am not sure what is the best path to take. The best solution would be something type-safe.
Anyway, thanks for this great idea of schema based form !
The text was updated successfully, but these errors were encountered: