-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type 'bigint' is not assignable to type 'ReactNode'. #7242
Comments
Please provide a sandbox with a minimal reproduction |
I'm encountering the same issue in my repository as well. It seems like with the latest release of Mantine (v7.15.0) something changed in the return types of the validator functions not matching up with the keys in the [email protected] const form = useForm<ProfileFormValues>({
enhanceGetInputProps: (payload) => {
let enhancedProps: object = {
onBlur: () => {
if (payload.form.isDirty(payload.field)) {
handleSubmit();
}
}
};
if (!payload.form.initialized) {
enhancedProps = { ...enhancedProps, disabled: true };
}
return enhancedProps;
},
validate: {
about: hasLength({ max: 500 }, "Bio must be 500 characters or less"),
firstName: hasLength({ min: 2, max: 50 }, "First name must be 2-50 characters long"),
lastName: hasLength({ min: 2, max: 50 }, "Last name must be 2-50 characters long"),
location: hasLength({ max: 100 }, "Location must be 100 characters or less")
},
transformValues: (values) => {
return {
...values,
about: values.about.trim(),
firstName: values.firstName.trim(),
lastName: values.lastName.trim(),
location: values.location.trim()
};
}
}); |
Same thing happens in this renovate PR for CommaFeed. If it helps, the error happens here. A simple reproducer :
|
It might be related to duplicated If you use react 18, then types need to be fixed for 18.x both for react and react-dom |
Happens to us as well. export function isNotEmpty(error?: React.ReactNode, ): (value: unknown) => (string | number | true | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null) With mantine 7.15.x: export function isNotEmpty(error?: React.ReactNode, ): (value: unknown) => (string | number | bigint | true | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<...>> | Iterable<React.ReactNode> | null | undefined> | null) Both scenarios are tested with: {
"name": "test",
"private": true,
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "vite",
},
"dependencies": {
"@mantine/core": "^7.15.1",
"@mantine/form": "^7.15.1",
"@mantine/hooks": "^7.15.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
},
"devDependencies": {
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@typescript-eslint/eslint-plugin": "^8.18.0",
"@typescript-eslint/parser": "^8.18.0",
"@vitejs/plugin-react": "^4.3.4",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-only-warn": "^1.1.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-react-refresh": "^0.4.16",
"postcss": "^8.4.49",
"postcss-preset-mantine": "^1.17.0",
"postcss-simple-vars": "^7.0.1",
"typescript": "^5.7.2",
"vite": "^6.0.3"
}
}
|
Have you tried following example solution from the linked comment? |
Yes. "overrides": {
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1"
} and While I understand its not necessary a mantine issue, downgrading to 7.14.3 makes the error go away, and it happens only in mantine form validators. |
I am experiencing same issue with my project set to React 18+. Just upgraded to latest version of mantine |
I am on NextJS 15.0.4 with react 18.3.1 going down to mantine 7.14.3 did not solve the problem for me |
I still cannot reproduce the issue, here is an example in codesandbox – https://codesandbox.io/p/sandbox/mantine-react-template-forked-23qg8f |
For Now I am disabling typescript to continue |
Thanks for the codesandbox! I get the error on the codesandbox if I add the |
It is not related to the issue. |
I'm sorry I don't understand :( What do you mean it's not related to the issue? If it helps, the error also happens with an initial value for |
|
Here's a codesandbox that reproduces the issue : https://codesandbox.io/p/sandbox/mantine-react-template-forked-3ltz32 |
Thanks for the reproduction, I've found and fixed the issue, it will be available with 7.15.2 patch |
Will this fix in 7.15.2 support react 19+ |
This issue is not related to react 19. |
@rtivital good~ |
same here - copying in the example from https://mantine.dev/form/uncontrolled/ is enough to get the error: import { useState } from 'react';
import { Button, Code, Text, TextInput } from '@mantine/core';
import { hasLength, isEmail, useForm } from '@mantine/form';
function Demo() {
const form = useForm({
mode: 'controlled',
initialValues: { name: '', email: '' },
validate: {
name: hasLength({ min: 3 }, 'Must be at least 3 characters'),
email: isEmail('Invalid email'),
},
});
const [submittedValues, setSubmittedValues] = useState<typeof form.values | null>(null);
return (
<form onSubmit={form.onSubmit(setSubmittedValues)}>
<TextInput {...form.getInputProps('name')} label="Name" placeholder="Name" />
<TextInput {...form.getInputProps('email')} mt="md" label="Email" placeholder="Email" />
<Button type="submit" mt="md">
Submit
</Button>
<Text mt="md">Form values:</Text>
<Code block>{JSON.stringify(form.values, null, 2)}</Code>
<Text mt="md">Submitted values:</Text>
<Code block>{submittedValues ? JSON.stringify(submittedValues, null, 2) : '–'}</Code>
</form>
);
} |
The issue is fixed, the fix will be available in 7.15.2 patch. |
Fixed in 7.15.2 |
Dependencies check up
What version of @mantine/* packages do you have in package.json?
7.15.0
What package has an issue?
@mantine/form
What framework do you use?
Vite
In which browsers you can reproduce the issue?
None
Describe the bug
after upgrade to 7.15.0 from 7.14.3
An error occurred with
npm run build
.[email protected]
[email protected]
If possible, include a link to a codesandbox with a minimal reproduction
No response
Possible fix
No response
Self-service
The text was updated successfully, but these errors were encountered: