We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c68b283 commit 537e9baCopy full SHA for 537e9ba
1 file changed
src/index.tsx
@@ -3,7 +3,7 @@ import { useFormContext } from 'react-hook-form';
3
import { FieldError } from 'react-hook-form/dist/types';
4
5
type ErrorFields = Record<string, FieldError>;
6
-type ErrorMessages<Errors> = Partial<Record<keyof Errors, string>>;
+type ErrorMessages = Record<string, string>;
7
8
const RHFError = <Errors extends ErrorFields, Name extends keyof Errors>({
9
as,
@@ -14,7 +14,7 @@ const RHFError = <Errors extends ErrorFields, Name extends keyof Errors>({
14
as?: React.ReactElement;
15
errors?: Errors;
16
name: Name;
17
- messages?: ErrorMessages<Errors>;
+ messages?: ErrorMessages;
18
}) => {
19
const methods = useFormContext();
20
const errors = errorsFromProps || (methods.errors as Errors);
0 commit comments