Skip to content
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

Value typing for Checkbox ToggleButtonGroup #3584

Merged
merged 4 commits into from
Apr 2, 2019
Merged

Value typing for Checkbox ToggleButtonGroup #3584

merged 4 commits into from
Apr 2, 2019

Conversation

mhermher
Copy link
Contributor

@mhermher mhermher commented Apr 2, 2019

Checkbox ToggleButtonGroup holds array of T rather than singleton.

Checkbox ToggleButtonGroup holds array of T rather than singleton.
Copy link
Member

@taion taion left a comment

Choose a reason for hiding this comment

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

see suggestion

types/components/ToggleButtonGroup.d.ts Outdated Show resolved Hide resolved
@jquense jquense self-requested a review April 2, 2019 14:56
value?: T;
defaultValue?: T;
value?: T[];
defaultValue?: T[];
Copy link
Member

Choose a reason for hiding this comment

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

wait no, these can be T or T[], depending on whether the type is checkbox or radio

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Checkbox and Radio Props have separate typings. The generalized typing is a union of those two. Is the radio supposed to be single-value and the checkbox multi-value? In that case, only the checkbox would have T[]. That is from my understanding at least.

Copy link
Member

Choose a reason for hiding this comment

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

yup those all come from ToggleButtonRadioProps

Copy link
Member

Choose a reason for hiding this comment

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

ha sorry, didn't notice that in the github diff view. tbf tho, the component always allows T or T[] regardless of type, but i'd agree it's better to have the types be stricter

types/components/ToggleButtonGroup.d.ts Show resolved Hide resolved
taion
taion previously approved these changes Apr 2, 2019
value?: T;
defaultValue?: T;
value?: T[];
defaultValue?: T[];
Copy link
Member

Choose a reason for hiding this comment

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

yup those all come from ToggleButtonRadioProps

@mhermher
Copy link
Contributor Author

mhermher commented Apr 2, 2019

Sorry, it says I dismissed your review Taion. Idk what that means, but a test was failing so I pushed another commit to fix that. That might have been the cause of that.

@taion taion merged commit 7a27c07 into react-bootstrap:master Apr 2, 2019
@mhermher mhermher deleted the patch-1 branch April 12, 2019 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants