@@ -1,16 +1,16 @@
11import cn from 'classnames';
22import React from 'react';
3−import { LiteralUnion, RegisterOptions, useFormContext } from 'react-hook-form';
3+import { FieldValues, LiteralUnion, RegisterOptions, useFormContext } from 'react-hook-form';
44
55type Validation = LiteralUnion<keyof RegisterOptions, string>;
66
7−interface ErrorMessageProps<T> {
7+interface ErrorMessageProps<T extends FieldValues> {
88 field: keyof T;
99 messages: Partial<Record<Validation, string>>;
1010 className?: string;
1111}
1212
13−export function ErrorMessage<T>({ field, messages, className }: ErrorMessageProps<T>) {
13+export function ErrorMessage<T extends FieldValues>({ field, messages, className }: ErrorMessageProps<T>) {
1414 const { formState } = useFormContext<T>();
1515 const error = formState.errors[field];
1616