-
-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is
If the schema is generated during runtime, you currently do not have a built-in way to help the editor infer the correct types.
Correct: the schema is inside the code, so the editor has no issues to infer the types:

Wrong: the schema was generated, so the editor infers a Strudel of all possible types:

Should
There should be ways, or atleast one way to get the correct field props for the particular situations. E.g. maybe a builtin CustomFieldStore helper type that returns the proper FieldStore type for the specified schema:
const numberSchema = v.number();
type CustomFieldStore<T extends v.GenericSchema> = FieldStore<
v.ObjectSchema<{ s: T }, undefined>,
['s']
>;
<Show when={dbField.type === 'number'}>
<Field of={loginForm()} path={[dbField.name]}>
{(field_) => {
const field = field_ as CustomFieldStore<typeof numberSchema>;
type V = typeof field.input;
return (
<TextInput
{...field.props}
input={field.input}
errors={field.errors}
type="number"
label={label()}
required
/>
);
}}
</Field>
</Show>Extras
- StackBlitz including a server-generated schema example: https://stackblitz.com/edit/formisch-playground-solid-wlnfcmcj?file=src%2Froutes%2Flogin%2Findex.tsx
- This feature request stems from the chat at https://bsky.app/profile/katywings.bsky.social/post/3mesribexgk2e
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
