-
-
Notifications
You must be signed in to change notification settings - Fork 248
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
feat: improve key type to support React.Key #692
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #692 +/- ##
=======================================
Coverage 99.58% 99.58%
=======================================
Files 27 27
Lines 721 721
Branches 196 198 +2
=======================================
Hits 718 718
Misses 3 3 ☔ View full report in Codecov by Sentry. |
@@ -6,14 +6,16 @@ interface ItemSharedProps { | |||
className?: string; | |||
} | |||
|
|||
export type MenuKey = React.Key; |
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.
这个好不容易是 string 了,又要改会 key 吗,如果要改,改成 T 吧
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.
React.Key 会有问题吗?
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.
里面包含 number,如果我想执行处理字符串的方法,还需要转一次字符串
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.
还是希望 string | number 都能支持,并且输入的类型和输出的类型一致,如果合并了 #692 ,那 React.Key 默认是不是就支持了?
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.
用泛型
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.
范型 +1,React.Key 有时会包含奇怪的东西,让用户自己指定 key 类型比较好
ref: ant-design/ant-design#47837