Skip to content

Commit

Permalink
Improve typing
Browse files Browse the repository at this point in the history
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
  • Loading branch information
SimonBrandner committed Sep 21, 2021
1 parent ec4f672 commit db1866c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/views/elements/PowerSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ interface IProps {

// should the user be able to change the value? false by default.
disabled?: boolean;
onChange?: (value: string, powerLevelKey: string) => void;
onChange?: (value: string | number, powerLevelKey: string) => void;

// Optional key to pass as the second argument to `onChange`
powerLevelKey?: string;
Expand Down Expand Up @@ -112,7 +112,7 @@ export default class PowerSelector extends React.Component<IProps, IState> {
this.setState({ custom: true });
} else {
this.props.onChange(event.target.value, this.props.powerLevelKey);
this.setState({ selectValue: parseInt(event.target.value) });
this.setState({ selectValue: event.target.value });
}
};

Expand All @@ -124,7 +124,7 @@ export default class PowerSelector extends React.Component<IProps, IState> {
event.preventDefault();
event.stopPropagation();

this.props.onChange(String(this.state.customValue), this.props.powerLevelKey);
this.props.onChange(this.state.customValue, this.props.powerLevelKey);
};

private onCustomKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {
Expand Down

0 comments on commit db1866c

Please sign in to comment.