mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-18 21:35:27 -04:00
Improve typings in FormInputGroup
This commit is contained in:
@@ -21,11 +21,15 @@ import {
|
||||
setDelayProfileValue,
|
||||
} from 'Store/Actions/settingsActions';
|
||||
import selectSettings from 'Store/Selectors/selectSettings';
|
||||
import DelayProfile from 'typings/DelayProfile';
|
||||
import { InputChanged } from 'typings/inputs';
|
||||
import translate from 'Utilities/String/translate';
|
||||
import styles from './EditDelayProfileModalContent.css';
|
||||
|
||||
const newDelayProfile: Record<string, boolean | number | number[] | string> = {
|
||||
const newDelayProfile: DelayProfile & { [key: string]: unknown } = {
|
||||
id: 0,
|
||||
name: '',
|
||||
order: 0,
|
||||
enableUsenet: true,
|
||||
enableTorrent: true,
|
||||
preferredProtocol: 'usenet',
|
||||
@@ -72,7 +76,11 @@ function createDelayProfileSelector(id: number | undefined) {
|
||||
delayProfiles;
|
||||
|
||||
const profile = id ? items.find((i) => i.id === id) : newDelayProfile;
|
||||
const settings = selectSettings(profile!, pendingChanges, saveError);
|
||||
const settings = selectSettings<DelayProfile>(
|
||||
profile!,
|
||||
pendingChanges,
|
||||
saveError
|
||||
);
|
||||
|
||||
return {
|
||||
isFetching,
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
setReleaseProfileValue,
|
||||
} from 'Store/Actions/Settings/releaseProfiles';
|
||||
import selectSettings from 'Store/Selectors/selectSettings';
|
||||
import { InputChanged } from 'typings/inputs';
|
||||
import ReleaseProfile from 'typings/Settings/ReleaseProfile';
|
||||
import translate from 'Utilities/String/translate';
|
||||
import styles from './EditReleaseProfileModalContent.css';
|
||||
@@ -101,9 +102,9 @@ function EditReleaseProfileModalContent({
|
||||
}, [dispatch, id]);
|
||||
|
||||
const handleInputChange = useCallback(
|
||||
(payload: { name: string; value: string | number }) => {
|
||||
(change: InputChanged) => {
|
||||
// @ts-expect-error 'setReleaseProfileValue' isn't typed yet
|
||||
dispatch(setReleaseProfileValue(payload));
|
||||
dispatch(setReleaseProfileValue(change));
|
||||
},
|
||||
[dispatch]
|
||||
);
|
||||
@@ -124,7 +125,6 @@ function EditReleaseProfileModalContent({
|
||||
name="name"
|
||||
{...name}
|
||||
placeholder={translate('OptionalName')}
|
||||
canEdit={true}
|
||||
onChange={handleInputChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
|
||||
Reference in New Issue
Block a user