Skip to content

Commit ecc4cd3

Browse files
authored
Merge pull request #3 from react-hook-form/fix-type
fixed type of messages props
2 parents c68b283 + 537e9ba commit ecc4cd3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useFormContext } from 'react-hook-form';
33
import { FieldError } from 'react-hook-form/dist/types';
44

55
type ErrorFields = Record<string, FieldError>;
6-
type ErrorMessages<Errors> = Partial<Record<keyof Errors, string>>;
6+
type ErrorMessages = Record<string, string>;
77

88
const RHFError = <Errors extends ErrorFields, Name extends keyof Errors>({
99
as,
@@ -14,7 +14,7 @@ const RHFError = <Errors extends ErrorFields, Name extends keyof Errors>({
1414
as?: React.ReactElement;
1515
errors?: Errors;
1616
name: Name;
17-
messages?: ErrorMessages<Errors>;
17+
messages?: ErrorMessages;
1818
}) => {
1919
const methods = useFormContext();
2020
const errors = errorsFromProps || (methods.errors as Errors);

0 commit comments

Comments
 (0)