We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm developing a form with formbit in Typescript and I ran into this problem:
I have my initialValues defined in this way
const schema = yup.object().shape({ adataord: yup.string().required(), dadataord: yup.string().required(), lbage: yup.string().required(), td_flags: yup.string().required(), }); type FormValues = { adataord: string; dadataord: string; lbage: string; td_flags: string; }; const initialValues: FormValues = { adataord: '', dadataord: '', lbage: '-1', td_flags: '99', }; const { write, form } = useFormbit({ initialValues, yup: schema });
I have a useState defined in this way
const [filters, setFilters] = useState(initialValues);
At a certain point I want to do
const handleOnFilter = () => { setFilters({ ...form }); };
However this raises a typescript error, saying that string | undefined is not assignable to type string, obliging me to do
string | undefined is not assignable to type string
const handleOnFilter = () => { setFilters({ adataord: form.adataord!, dadataord: form.dadataord!, lbage: form.lbage!, td_flags: form.td_flags!, }); };
I'm not getting why formbit addresses the types as nullables, while I defined them as non-nullables. Am I making any mistake?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm developing a form with formbit in Typescript and I ran into this problem:
I have my initialValues defined in this way
I have a useState defined in this way
At a certain point I want to do
However this raises a typescript error, saying that
string | undefined is not assignable to type string
, obliging me to doI'm not getting why formbit addresses the types as nullables, while I defined them as non-nullables.
Am I making any mistake?
The text was updated successfully, but these errors were encountered: