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
[docs] Add CheckboxesGroup TypeScript demo #15228
Conversation
donigianrp
commented
Apr 6, 2019
•
edited
edited
- I have followed (at least) the PR section of the contributing guide.
TS does not like |
return ( | ||
<div className={classes.root}> | ||
<FormControl component={'fieldset' as 'div'} className={classes.formControl}> | ||
<FormLabel component={'legend' as 'div'}>Assign responsibility</FormLabel> |
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.
What 'fieldset' as 'div'
means is to lie to typescript that we actually use the default component. For FormControl
this is div
for FormLabel
it would be label
.
I guess legend
is rejected? If so we need to cast it the the default component.
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.
You need to run yarn:typescript:formatted
to include the formatting changes in the JS demos. The changes are perfectly fine. I'm fairly certain it would be something similar to
-component="div"
+component={'div'}
No bundle size changes comparing e1b5fac...d406e5a |
|
import FormLabel from '@material-ui/core/FormLabel'; | ||
import FormControl from '@material-ui/core/FormControl'; | ||
import FormGroup from '@material-ui/core/FormGroup'; | ||
import FormControlLabel from '@material-ui/core/FormControlLabel'; | ||
import FormHelperText from '@material-ui/core/FormHelperText'; | ||
import Checkbox from '@material-ui/core/Checkbox'; | ||
|
||
const useStyles = makeStyles(theme => ({ | ||
const styles = theme => ({ |
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.
Seems like you were migrating an outdated version of CheckboxesGroup
. CheckboxesGroup.tsx
should use the same styling solution.
…nd with the js file, restore CheckboxesGroup.js to it's original file