TypeScript 抱怨 rc-tree Tree 没有 treeData 属性
TypeScript complaining that rc-tree Tree doesn't have a treeData prop
在我的 React 组件中有来自 react-component/tree、
的以下代码
import Tree from 'rc-tree';
...
<Tree
className="treeThingy"
treeData={myTreeData}
/>
这行得通,但是打字稿抱怨 treeData
道具在树上不存在,
Property 'treeData' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly & Readonly<{ children?: ReactNode; }>'.ts(2322)
这是我的代码、rc-tree 代码还是其他问题?
似乎更多的是 @types/rc-tree
类型声明的问题,而不是库。 TreeProps
缺少 treeData
道具,但图书馆有。
从版本 3 开始,react-component/tree
似乎将在包本身中包含类型,而不依赖于 DefinitelyTyped 包。
在我的 React 组件中有来自 react-component/tree、
的以下代码import Tree from 'rc-tree';
...
<Tree
className="treeThingy"
treeData={myTreeData}
/>
这行得通,但是打字稿抱怨 treeData
道具在树上不存在,
Property 'treeData' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly & Readonly<{ children?: ReactNode; }>'.ts(2322)
这是我的代码、rc-tree 代码还是其他问题?
似乎更多的是 @types/rc-tree
类型声明的问题,而不是库。 TreeProps
缺少 treeData
道具,但图书馆有。
从版本 3 开始,react-component/tree
似乎将在包本身中包含类型,而不依赖于 DefinitelyTyped 包。