Skip to content

Commit

Permalink
[SelectInput] Fix event.target type in onChange callback
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Apr 11, 2019
1 parent b4b4971 commit ffc6f5e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 2 additions & 4 deletions docs/src/pages/demos/dialogs/MaxWidthDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@ class MaxWidthDialog extends React.Component {
this.setState({ open: false });
};

handleMaxWidthChange = (event, value) => {
this.setState({
maxWidth: value,
});
handleMaxWidthChange = event => {
this.setState({ maxWidth: event.target.value });
};

handleFullWidthChange = event => {
Expand Down
6 changes: 2 additions & 4 deletions docs/src/pages/demos/dialogs/MaxWidthDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ class MaxWidthDialog extends React.Component<MaxWidthDialogProps, MaxWidthDialog
this.setState({ open: false });
};

handleMaxWidthChange = (event: React.ChangeEvent<HTMLSelectElement>, value: any) => {
this.setState({
maxWidth: value as DialogProps['maxWidth'],
});
handleMaxWidthChange = (event: React.ChangeEvent<{ value: unknown }>) => {
this.setState({ maxWidth: event.target.value as MaxWidthDialogState['maxWidth'] });
};

handleFullWidthChange = (event: React.ChangeEvent<HTMLInputElement>) => {
Expand Down
5 changes: 4 additions & 1 deletion packages/material-ui/src/Select/SelectInput.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export interface SelectInputProps {
name?: string;
native: boolean;
onBlur?: React.FocusEventHandler<any>;
onChange?: (event: React.ChangeEvent<HTMLSelectElement>, child: React.ReactNode) => void;
onChange?: (
event: React.ChangeEvent<{ name?: string; value: unknown }>,
child: React.ReactNode,
) => void;
onClose?: (event: React.ChangeEvent<{}>) => void;
onFocus?: React.FocusEventHandler<any>;
onOpen?: (event: React.ChangeEvent<{}>) => void;
Expand Down

0 comments on commit ffc6f5e

Please sign in to comment.