ITADN

fix accessing array field type by path

#289Pull Requestcreate-signal 创建于 2025-05-27
bug
C
create-signalcommented
The Field component seems to show type errors when used with an Array field that is not an object - for example: ``` const TestComponent = () => { const [form, { Form, Field }] = createForm<{ values: number[] }>({ initialValues: { values: [1, 2, 3] }, }); return ( <Form onSubmit={() => {}}> <Field name="values.0" type="number"> {(field, props) => ( <input type="number" {...props} value={field.value} /> )} </Field> </Form> ); }; ``` Will show the errors - on the "type" prop - "Type 'string' is not assignable to type 'undefined'." - the type of "field.value" will be "undefined" This PR updates the PathValue helper to allow looking up a value by array index
合并状态:未合并 2 条评论