-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
fix: declare Tree Component type #3178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
components/tree/util.ts
Outdated
// TODO: Move this logic into `rc-tree` | ||
function traverseNodesKey(rootChildren, callback) { | ||
function traverseNodesKey(rootChildren: VNode[], callback?: Function) { | ||
console.log(rootChildren) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lint 挂了
@@ -14,6 +14,46 @@ import { cloneElement } from '../_util/vnode'; | |||
import { defaultConfigProvider } from '../config-provider'; | |||
|
|||
const TreeNode = VcTree.TreeNode; | |||
|
|||
export interface TreeDataItem { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
很多字段是可选的吧
居然全都是可选的。。 |
components/tree/Tree.tsx
Outdated
checkable?: boolean; | ||
icon?: any; | ||
slots?: any; | ||
scopedSlots?: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
没有 scopedSlots
这个属性了吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看逻辑上这个属性还是在的,文档上是没了 我给他去掉
可以把 props 里面 treeData 的类型也定义一下 |
嗯嗯 |
treeData下的children做类型递归有点问题。。 |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
First of all, thank you for your contribution! 😄
New feature please send pull request to feature branch, and rest to master branch. Pull request will be merged after one of collaborators approve. Please makes sure that these form are filled before submitting your pull request, thank you!
[中文版模板 / Chinese template]
This is a ...
Changelog description (Optional if not new feature)
这个tree组件花了挺长时间看的,之前没敢动因为缺失挺多类型的,然后发现了DirectoryTree.tsx文件中lastSelectedKey的默认值是空数组导致类型判断出了问题,在组件中其他位置用法都是string就默认给了个空字符串,这里做了一个小改动,然后添加了一些interface来给这几个组件做声明,字段是按文档给来声明的,如果有缺失或者错误的请指出~~