我正在使用带有 typescript 和 material-ui 的 react-hook-form。我想将错误消息作为 tohelperText传递TextField。我试图这样做,
helperText={errors.email?.message}
但打字稿抱怨这个任务。
Property 'email' does not exist on type 'NestDataObject<FormData>'.ts(2339)
我不想从我的 .eslintrc 文件中禁用此规则,因为它可能会忽略我的应用程序中的其他类似问题,这在某些地方可能是需要的。将 react-hook-form 的错误消息作为 helperText 分配给 material-ui 组件的正确方法是什么?
代码沙盒链接 https://codesandbox.io/s/material-ui-react-form-hook-yi669