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

Rewrite in Typescript: RadioGroup #308

Closed
wants to merge 4 commits into from

Conversation

zaki-yama
Copy link
Collaborator

ref. #289

TODO: after #307 is merged, change the base branch to 3.0.

@zaki-yama zaki-yama self-assigned this May 28, 2019
@stomita stomita mentioned this pull request May 28, 2019
41 tasks
className?: string;
label?: string;
required?: boolean;
error?: any; // FIXME: should be FormElementProps.error
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fix this after FormElement is converted to TypeScript

if (this.props.onChange) {
this.props.onChange(e, value);
}
}

renderControl(radio) {
renderControl(radio: any) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I couldn't figure out how I can give more strict type annotation here and onChange prop.
It seems children are expected to only <Radio> component, but I didn't know how I express this.

@@ -60,7 +72,6 @@ export default class RadioGroup extends React.Component {
: undefined
: undefined;

delete props.onChange;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since TypeScript doesn't recognize that a certain property is deleted, a type error occured here

<fieldset className={grpClassNames} style={grpStyles} {...props}>

(related to this? microsoft/TypeScript#13783)

So I used destructuring assignment above.

@zaki-yama
Copy link
Collaborator Author

Closed because the last PR #342 had been merged.

@zaki-yama zaki-yama closed this Oct 28, 2019
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

1 participant