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
In the following code, during the validation function for users.tags.tag, the values parameter should contain data of type FormValues. However, it's incorrectly inferred as { tag: string; key: string; }.
import{randomId}from"@mantine/hooks";import{useForm}from"@mantine/form";typeFormValues={users: {name: string;key: string;tags: {tag: string;key: string;}[];}[];};exportdefaultfunctionApp(){constinitialValues: FormValues={users: [{name: "Dan Abramov",key: randomId(),tags: [{tag: "React",key: randomId()}],},],};constform=useForm({
initialValues,validate: {users: {name: (value,values,path)=>{console.log("validate users.name",{ value, values, path });if(value==="")return"Name is required";returnnull;},tags: {tag: (value,values,path)=>{// Here, the 'values' actually contains a value of type FormValues, but for some reason, it's inferred as { tag: string; key: string; }console.log("validate users.tags.tag",{ value, values, path });if(value==="")return"Tag is required";returnnull;},},},},});return<>{/* Omitted for brevity */}</>;}
What version of @mantine/hooks page do you have in package.json?
6.0.20
If possible, please include a link to a codesandbox with the reproduced problem
What package has an issue
@mantine/form
Describe the bug
In the following code, during the validation function for
users.tags.tag
, the values parameter should contain data of typeFormValues
. However, it's incorrectly inferred as{ tag: string; key: string; }
.What version of @mantine/hooks page do you have in package.json?
6.0.20
If possible, please include a link to a codesandbox with the reproduced problem
https://codesandbox.io/s/nostalgic-wood-9dnyr6?file=/src/App.tsx
Do you know how to fix the issue
None
Are you willing to participate in fixing this issue and create a pull request with the fix
None
Possible fix
No response
The text was updated successfully, but these errors were encountered: