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

[core] Fix some errors when porting demos to TypeScript #12417

Merged
merged 6 commits into from
Aug 6, 2018

Conversation

PavelPZ
Copy link
Contributor

@PavelPZ PavelPZ commented Aug 5, 2018

Porting https://github.com/mui-org/material-ui/tree/master/docs/src/pages/demos to typescript arrise some errors, see my commit's comments.

Thanks for merging

PavelPZ added 3 commits August 5, 2018 13:30
Porting https://github.com/mui-org/material-ui/blob/master/docs/src/pages/demos/autocomplete/IntegrationDownshift.js to typescript does not works in line 281:
```
 <Popper open={isOpen} anchorEl={popperNode}>
              <Paper square style={{ width: popperNode ? popperNode.clientWidth : null }}>
```
Porting https://github.com/mui-org/material-ui/blob/master/docs/src/pages/demos/dialogs/ConfirmationDialog.js to typescript does not works in line 83:
```
<RadioGroup
            ref={ref => {
              this.radioGroupRef = ref;
            }}```
Porting https://github.com/mui-org/material-ui/blob/master/docs/src/pages/demos/text-fields/TextFields.js to typescript does not works in line 106:
```
 <TextField
          id="read-only-input"
          label="Read Only"
          defaultValue="Hello World"
          className={classes.textField}
          margin="normal"
          InputProps={{
            readOnly: true,
          }}
        />
```
@@ -7,6 +7,7 @@ export interface RadioGroupProps
name?: string;
onChange?: (event: React.ChangeEvent<{}>, value: string) => void;
value?: string;
ref?;
Copy link
Member

Choose a reason for hiding this comment

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

Something is wrong, ref is a native React property. We shouldn't have to declare it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed, my mistake

@@ -23,6 +23,7 @@ export interface InputProps
multiline?: boolean;
name?: string;
placeholder?: string;
readOnly?:boolean;
Copy link
Member

Choose a reason for hiding this comment

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

You can run yarn prettier to fix the code style.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -20,12 +20,12 @@ export type PopperPlacementType =
export interface PopperProps extends React.HTMLAttributes<HTMLDivElement> {
transition?: boolean;
anchorEl?: null | HTMLElement | ReferenceObject | ((element: HTMLElement) => HTMLElement);
children: (
children: React.ReactElement<any> | ((
Copy link
Member

Choose a reason for hiding this comment

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

It can be a node, I believe we should be using React.ReactNode.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

props: {
placement: PopperPlacementType;
TransitionProps?: TransitionProps;
},
) => React.ReactElement<any>;
) => React.ReactElement<any>);
Copy link
Member

Choose a reason for hiding this comment

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

React.ReactNode most likely.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@oliviertassinari oliviertassinari added PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI typescript labels Aug 5, 2018
@oliviertassinari oliviertassinari removed the PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI label Aug 6, 2018
@oliviertassinari oliviertassinari changed the title Typescript: errors when porting demos to typescript [core] Fix some errors when porting demos to TypeScript Aug 6, 2018
@oliviertassinari oliviertassinari merged commit a632bc9 into mui:master Aug 6, 2018
@oliviertassinari
Copy link
Member

@PavelPZ Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants