我有一个demo
这是一个使用GitHub API来显示用途和化身的简单应用。
我有一个Users组件,该组件列出了该状态下的用户数据。
这使用UserItem组件显示状态中的数据。
这里的示例实际上可以工作,但是我在本地拥有的那个
我在Users组件中的thr UserItem组件上收到错误。
错误是
No overload matches this call.
Overload 1 of 2, '(props: Readonly<IUserItemProps>): UserItem', gave the following error.
Type '{ user: { id: string; login: string; avatar_url: string; html_url: string; }; }' is missing the following properties from type 'Readonly<IUserItemProps>': login, avatar_url, html_url
Overload 2 of 2, '(props: IUserItemProps, context?: any): UserItem', gave the following error.
Type '{ user: { id: string; login: string; avatar_url: string; html_url: string; }; }' is missing the following properties from type 'Readonly<IUserItemProps>': login, avatar_url, html_url
我知道这是一个打字稿问题,但是我该如何更新界面以阻止此问题。
答案 0 :(得分:0)
基于该错误,您正在尝试使用具有user
属性的对象,其中应使用具有login
,avatar_url
和html_url
属性的对象。
当前使用x
(具有user
属性的对象)的地方,请改用x.user
。