我在NextJS中使用了react 挂钩形式和打字脚本, 这是我的表格钩子
const schema = yup.object().shape({
email: yup.string().email().required(),
password: yup.string().min(8).max(32).required(),
});
const { register, handleSubmit, formState } = useForm<IAuthLogin>({
defaultValues: {
email: '', // Set initial value for email field
password: '', // Set initial value for password field
},
resolver: yupResolver(schema),
});
接口
export interface IAuthLogin {
email: string;
password: string;
is_admin: boolean;
}
问题是解析器,我的VS代码在它下面给了我红线,并说, see the screenshot of error个
在这种情况下,如何将类型分配给解析程序?
我似乎真的想不出如何为它分配类型,
我查看了Reaction-Hook-Form,here,其中有一个解析器类型定义的示例,
但在我的 case 中,我使用的是YUP来创建模式,请帮助我解决这个问题!