-
-
Notifications
You must be signed in to change notification settings - Fork 100
Open
Labels
bugSomething isn't workingSomething isn't working
Description
- Before posting an issue, read the FAQ and search the previous issues.
Description & Reproduction
Check this code (don't change branches): https://github.com/gyenabubakar/superforms-infinite-id-warnings/tree/valibot-incorrect-input-types
Inside src/routes/+page.svelte
, the inferred type of formData
is:
SuperFormData<{
email?: string | undefined;
phone?: string | undefined;
password: string;
}>
The type of the phone
property is incorrect. It's supposed to be:
SuperFormData<{
email?: string | undefined;
phone?: {
code: <string union>;
number: string;
};
password: string;
}>
I .transform
the phone object above into a string using libphonenumber-js
. So, the transform should only happen after the form data passes the schema check. But in this case, it seems the Superforms adapter for Valibot infers the output type of objects instead of the input type. This problem seems to exist for the Zod adapter as well.
Does Superforms not support nested objects?
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working