Skip to content
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

Formik isInvalid form control string-possibility are not liked by ChakraUI typings #3479

Open
wethinkagile opened this issue Feb 3, 2022 · 0 comments

Comments

@wethinkagile
Copy link

wethinkagile commented Feb 3, 2022

Bug report

Current Behavior

Formik String possibility is not liked by ChakraUI boolean typings:

<FormControl isInvalid={form.errors.name && form.touched.name}>

Expected behavior

Building the app fails with same info as in my IDE:

TS2322: Type 'boolean | "" | FormikTouched<any> | FormikTouched<any>[] | undefined' is not assignable to type 'boolean | undefined'.   Type '""' is not assignable to type 'boolean | undefined'.  form-control.d.ts(22, 5): The expected type comes from property 'isInvalid' which is declared here on type 'IntrinsicAttributes & OmitCommonProps<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof FormControlProps> & FormControlProps & OmitCommonProps<...> & { ...; }'

Reproducible example

not necessary

Suggested solution(s)

Typing for ChakraUI need type safety with booleans for isInvalid form control

Additional context

Workaround/Hack

<FormControl isInvalid={!(!form.errors.name) && !(!form.touched.name)}>`

Related

#3152

Your environment

Software Version(s)
Formik 2.2.9
React 17.0.2
TypeScript 4.5.4
Browser Mozilla
npm/Yarn 1.22.17
Operating System Arch
@wethinkagile wethinkagile changed the title Make Formik Code is not liked by ChakraUI typings Feb 3, 2022
@wethinkagile wethinkagile changed the title Formik Code is not liked by ChakraUI typings Formik isInvalid form control string-possibility are not liked by ChakraUI typings Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant