小编hom*_*rus的帖子

类型 '({ items }: PropsWithChildren<TodoProps>) => Element[]' 不可分配给类型 'FunctionComponent<TodoProps>'

我正在学习 Typescript-react,但我陷入了这个错误Type '({ items }: PropsWithChildren<TodoProps>) => Element[]' is not assignable to type 'FunctionComponent<TodoProps>',对此我迷失了。

完全错误:

Type '({ items }: PropsWithChildren<TodoProps>) => Element[]' is not assignable to type 'FunctionComponent<TodoProps>'.
  Type 'Element[]' is missing the following properties from type 'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>': type, props, key
Run Code Online (Sandbox Code Playgroud)

代码链接:sandbox repo。

文件中的TodoList函数声明发生错误TodoList.tsx。

任何帮助表示赞赏。干杯! …

typescript reactjs react-typescript

15
推荐指数
1
解决办法
1万
查看次数

标签 统计

react-typescript ×1

reactjs ×1

typescript ×1