Fix type error

This commit is contained in:
Thomas Nordquist
2019-06-04 10:45:02 +02:00
parent 050ba81760
commit 348b72ea69
2 changed files with 10 additions and 5 deletions

View File

@@ -133,8 +133,8 @@ class Settings extends React.Component<Props, {}> {
) )
} }
private onChangeAutoExpand = (e: React.ChangeEvent<HTMLSelectElement>) => { private onChangeAutoExpand = (e: React.ChangeEvent<{value: unknown}>) => {
this.props.actions.settings.setAutoExpandLimit(parseInt(e.target.value, 10)) this.props.actions.settings.setAutoExpandLimit(parseInt(String(e.target.value), 10))
} }
private renderNodeOrder() { private renderNodeOrder() {
@@ -160,7 +160,7 @@ class Settings extends React.Component<Props, {}> {
</div>) </div>)
} }
private onChangeSorting = (e: React.ChangeEvent<HTMLSelectElement>) => { private onChangeSorting = (e: React.ChangeEvent<{value: unknown}>) => {
this.props.actions.settings.setTopicOrder(e.target.value as TopicOrder) this.props.actions.settings.setTopicOrder(e.target.value as TopicOrder)
} }

View File

@@ -32,16 +32,21 @@ function TimeLocaleSettings(props: Props) {
</MenuItem> </MenuItem>
)) ))
function updateLocale(e: React.ChangeEvent<{value: unknown}>) {
const locale = e.target.value ? String(e.target.value) : ''
actions.settings.setTimeLocale(locale)
}
return ( return (
<div style={{ padding: '8px', display: 'flex' }}> <div style={{ padding: '8px', display: 'flex' }}>
<InputLabel htmlFor="time-locale" style={{ flex: '1', marginTop: '8px' }}>Time Locale</InputLabel> <InputLabel htmlFor="time-locale" style={{ flex: '1', marginTop: '8px' }}>Time Locale</InputLabel>
<Select <Select
value={timeLocale} value={timeLocale}
onChange={e => actions.settings.setTimeLocale(e.target.value)} onChange={updateLocale}
input={<Input name="time-locale" id="time-locale-label-placeholder" />} input={<Input name="time-locale" id="time-locale-label-placeholder" />}
name="time-locale" name="time-locale"
className={classes.input} className={classes.input}
renderValue={(v) => <span>{v}</span>} renderValue={v => <span>{String(v)}</span>}
style={{ flex: '1' }} style={{ flex: '1' }}
> >
{localeMenuItems} {localeMenuItems}