feat: improve key type to support React.Key#692
feat: improve key type to support React.Key#692madocto wants to merge 1 commit intoreact-component:masterfrom
Conversation
Codecov Report✅ All 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. 🚀 New features to boost your workflow:
|
| className?: string; | ||
| } | ||
|
|
||
| export type MenuKey = React.Key; |
There was a problem hiding this comment.
这个好不容易是 string 了,又要改会 key 吗,如果要改,改成 T 吧
There was a problem hiding this comment.
里面包含 number,如果我想执行处理字符串的方法,还需要转一次字符串
There was a problem hiding this comment.
还是希望 string | number 都能支持,并且输入的类型和输出的类型一致,如果合并了 #692 ,那 React.Key 默认是不是就支持了?
There was a problem hiding this comment.
范型 +1,React.Key 有时会包含奇怪的东西,让用户自己指定 key 类型比较好
There was a problem hiding this comment.
React.Key is the type used in the dependency rc-menu
Line 54 in f94aec3
key prop, I feel this type should follow the dependency type instead of forcing string
ref: ant-design/ant-design#47837