mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 00:32:43 +10:00
fix: add hack for root zod validation with hook form
This commit is contained in:
@ -4,13 +4,17 @@ import { cn } from '@documenso/ui/lib/utils';
|
||||
|
||||
export type FormErrorMessageProps = {
|
||||
className?: string;
|
||||
error: { message?: string } | undefined;
|
||||
error: { message?: string } | undefined | unknown;
|
||||
};
|
||||
|
||||
const isErrorWithMessage = (error: unknown): error is { message?: string } => {
|
||||
return typeof error === 'object' && error !== null && 'message' in error;
|
||||
};
|
||||
|
||||
export const FormErrorMessage = ({ error, className }: FormErrorMessageProps) => {
|
||||
return (
|
||||
<AnimatePresence>
|
||||
{error && (
|
||||
{isErrorWithMessage(error) && (
|
||||
<motion.p
|
||||
initial={{
|
||||
opacity: 0,
|
||||
|
||||
Reference in New Issue
Block a user