react-hook-form: [TypeScript] ErrorMessage Component accept no props any more in version 4.8.0
Describe the bug
after I updated to v4.8.0 I got this error message from Typescript
on the className and name props
Type 'string' is not assignable to type 'never'.ts(2322)
also errors prop got this following error
Type 'NestDataObject<Record<string, any>>' is not assignable to type 'never'.ts(2322)
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 21 (14 by maintainers)
Commits related to this issue
- close #954 fix type for ErrorMessage component props (#966) — committed to react-hook-form/react-hook-form by kotarella1110 4 years ago
I’m busy today, so I wil look it tomorrow.
This has not been resolved yet. Passing the
nameanderrorsprop shouldn’t cause type error.I will wait for @omarkhatibco to provide codesandbox.
wow type is great! great job @kotarella1110
@kotarella1110 thanks it works !
The problem is
asprop is not mentioned in the documentation.@omarkhatibco Causes this type error when
strictis disabled(false) in Compiler Option(tsconfig.json). You can avoid this type error by enablingstrictorstrictNullChecks. I will fix this soon because of a problem with the type definition.@bluebill1049 the type error is correct! because we can’t have className as a prop on
React.Fragment. we can pass theclassNameprop only when we pass theasprop.@omarkhatibco plz provide codesandbox example.
@kotarella1110 type of
nameis never whenasis missingthanks @kotarella1110 🙉