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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Collapse Panel key type definition #17557
Conversation
Deploy preview for ant-design ready! Built with commit 3ba28db |
@thylsky Remember to rebase it. |
Fixed. 馃憤 |
Codecov Report
@@ Coverage Diff @@
## master #17557 +/- ##
=======================================
Coverage 96.04% 96.04%
=======================================
Files 267 267
Lines 7430 7430
Branches 2061 2034 -27
=======================================
Hits 7136 7136
Misses 292 292
Partials 2 2
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #17557 +/- ##
=======================================
Coverage 96.04% 96.04%
=======================================
Files 267 267
Lines 7430 7430
Branches 2061 2034 -27
=======================================
Hits 7136 7136
Misses 292 292
Partials 2 2
Continue to review full report at Codecov.
|
@thylsky |
@dengfuping Good catch, thanks! Resolved. |
@@ -4,7 +4,7 @@ import classNames from 'classnames'; | |||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider'; | |||
|
|||
export interface CollapsePanelProps { | |||
key: string; | |||
key: string | 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.
activeKey
and defaultActiveKey
also.
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.
I don't think it's necessary to add the activeKey and the defaultActiveKey here. It should be defined in the Collapse parent component.
馃 This is a ...
馃懟 What's the background?
Describe the source of requirement, like related issue link.
Currently the allowed key for the
Collapse.Panel
is just string.Describe the problem and the scenario.
When you are rendering
Collapse.Panel
with map function, you can't simply provide just index of the map function. Also React's definition for Key type isnumber | string
.馃挕 Solution
Fix is prepared in this PR: Changing type definition of the
key
props.馃摑 Changelog
鈽戯笍 Self Check before Merge
View rendered components/collapse/index.en-US.md
View rendered components/collapse/index.zh-CN.md