diff --git a/src/components/SimpleToggleField.tsx b/src/components/SimpleToggleField.tsx index 343aae0..2e05697 100644 --- a/src/components/SimpleToggleField.tsx +++ b/src/components/SimpleToggleField.tsx @@ -3,25 +3,25 @@ import * as React from 'react' import { Config } from 'utils/configHelper' import { Field } from './settings/Field' -export type SimpleField = { - key: keyof Config +export type SimpleField = { + key: Key label: string wikiLink?: string tooltip?: string description?: string overwrite?: { - value: (value: T) => boolean - onChange: (checked: boolean) => any + value: (value: Config[Key]) => boolean + onChange: (checked: boolean) => Config[Key] } } -type Props = { - field: SimpleField +type Props = { + field: SimpleField onChange?(): void } -export function SimpleToggleField({ field, onChange }: Props) { +export function SimpleToggleField({ field, onChange }: Props) { const { overwrite } = field const configContext = useConfigs() const value = configContext.value[field.key] diff --git a/src/components/settings/SettingsBar.tsx b/src/components/settings/SettingsBar.tsx index d7f146d..6f84007 100644 --- a/src/components/settings/SettingsBar.tsx +++ b/src/components/settings/SettingsBar.tsx @@ -29,7 +29,7 @@ function SettingsBarContent() { const useReloadHint = useStateIO('') const { value: reloadHint } = useReloadHint - const moreFields: SimpleField[] = + const moreFields: SimpleField<'copyFileButton' | 'copySnippetButton'>[] = platform === GitHub ? [ {