我在我的 create react 应用程序中设置了 typeorm。现在在安装 graphql-codegen
并为突变创建类型后,我创建了这个函数
const Posts: React.FC<{}> = ({}) => {
const [, doVote] = useVoteMutation();
....
现在在组件端
interface Props {
OnPostClick:()=>void;
deletePost:()=>void;
doVote:({variables?: {
value: number;
postId: number;
}
}) => void;
points:number;
...
}
const Post:React.FC<Props> = ({
OnPostClick,
deletePost,
doVote,
points,
....
}) => (<div> ... </div>)
现在 doVote 函数给出了类型错误。
Member 'void' implicitly has an 'any' type.ts(7008)
如何解决这个问题?