-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Description
Zod 3.25.20
Typescript 5.7
"turbo": "^2.5.3",
i am receiving Type instantiation is excessively deep and possibly infinite.ts(2589)
import { useForm } from "react-hook-form";
import { z } from "zod";
import { zodResolver } from "@hookform/resolvers/zod";
import {
Form,
FormField,
FormItem,
FormLabel,
FormControl,
FormMessage,
} from "./form";
import { Input } from "./input";
import { Button } from "./button";
const formSchema = z.object({
name: z.string().min(2, { message: "İsim en az 2 karakter olmalı" }),
email: z.string().email({ message: "Geçerli bir e-posta girin" }),
});
type FormSchema = {
name: string;
email: string;
};
export default function UserForm() {
const form = useForm<FormSchema>({
resolver: zodResolver(formSchema),
defaultValues: {
name: "",
email: "",
},
});
const onSubmit = (values: FormSchema) => {
console.log("Form gönderildi:", values);
};
return (
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
className="max-w-md space-y-4"
>
<FormField
control={form.control}
name="name"
render={({ field }) => (
<FormItem>
<FormLabel>İsim</FormLabel>
<FormControl>
<Input placeholder="Adınızı girin" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="email"
render={({ field }) => (
<FormItem>
<FormLabel>Email</FormLabel>
<FormControl>
<Input
type="email"
placeholder="E-posta adresinizi girin"
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<Button type="submit">Gönder</Button>
</form>
</Form>
);
}
camdencheek, vuki656, gr2m, zrosenbauer, kosukeoya and 1 morelo1tuma, ahmettavsan, dr1ss, vuki656, zrosenbauer and 1 more
Metadata
Metadata
Assignees
Labels
No labels