Skip to content

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

Merged
merged 5 commits into from
Nov 18, 2020
Merged

fix: declare Tree Component type #3178

merged 5 commits into from
Nov 18, 2020

Conversation

ajuner
Copy link
Member

@ajuner ajuner commented Nov 14, 2020

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 ...

  • New feature
  • Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Branch merge
  • Other (about what?)

Changelog description (Optional if not new feature)

这个tree组件花了挺长时间看的,之前没敢动因为缺失挺多类型的,然后发现了DirectoryTree.tsx文件中lastSelectedKey的默认值是空数组导致类型判断出了问题,在组件中其他位置用法都是string就默认给了个空字符串,这里做了一个小改动,然后添加了一些interface来给这几个组件做声明,字段是按文档给来声明的,如果有缺失或者错误的请指出~~

// TODO: Move this logic into `rc-tree`
function traverseNodesKey(rootChildren, callback) {
function traverseNodesKey(rootChildren: VNode[], callback?: Function) {
console.log(rootChildren)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lint 挂了

@ajuner ajuner requested a review from Amour1688 November 16, 2020 02:34
@@ -14,6 +14,46 @@ import { cloneElement } from '../_util/vnode';
import { defaultConfigProvider } from '../config-provider';

const TreeNode = VcTree.TreeNode;

export interface TreeDataItem {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

很多字段是可选的吧

@ajuner
Copy link
Member Author

ajuner commented Nov 17, 2020

居然全都是可选的。。

@ajuner ajuner requested a review from tangjinzhou November 17, 2020 14:31
checkable?: boolean;
icon?: any;
slots?: any;
scopedSlots?: any;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有 scopedSlots 这个属性了吧

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看逻辑上这个属性还是在的,文档上是没了 我给他去掉

@ajuner ajuner requested a review from Amour1688 November 17, 2020 15:02
@Amour1688
Copy link
Member

可以把 props 里面 treeData 的类型也定义一下

@ajuner
Copy link
Member Author

ajuner commented Nov 17, 2020

可以把 props 里面 treeData 的类型也定义一下

嗯嗯

@ajuner
Copy link
Member Author

ajuner commented Nov 17, 2020

treeData下的children做类型递归有点问题。。

@Amour1688 Amour1688 merged commit de05f93 into vueComponent:next Nov 18, 2020
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants