diff --git a/lib/SettingsContext.tsx b/lib/SettingsContext.tsx index 94e66d0..792f37e 100644 --- a/lib/SettingsContext.tsx +++ b/lib/SettingsContext.tsx @@ -6,7 +6,6 @@ import type { SettingsStateContextType, SerializedSettingsState, KeyBindings, - KeyCommand, } from './types'; import { defaultKeyBindings, commonKeyBindings } from './keybindings'; import { usePersistToLocalStorage } from './persistence'; @@ -21,7 +20,7 @@ const initialState: SettingsState = { function serializeSettingsState(state: SettingsState): SerializedSettingsState { return { ...state, - keybindings: Object.entries(state.keybindings).reduce( + keybindings: Object.entries(state.keybindings).reduce>( (acc, [key, value]) => { const commonName = Object.entries(commonKeyBindings).find(([_, v]) => v === value)?.[0]; if (commonName) { @@ -29,7 +28,7 @@ function serializeSettingsState(state: SettingsState): SerializedSettingsState { } return acc; }, - {} as Record, + {}, ), }; } @@ -39,13 +38,13 @@ function deserializeSettingsState(state: SerializedSettingsState): SettingsState ...state, keybindings: { ...defaultKeyBindings, - ...Object.entries(state.keybindings).reduce((acc, [key, commonName]) => { + ...Object.entries(state.keybindings).reduce((acc, [key, commonName]) => { const commonBinding = commonKeyBindings[commonName as keyof typeof commonKeyBindings]; if (commonBinding) { acc[key as keyof typeof defaultKeyBindings] = commonBinding; } return acc; - }, {} as KeyBindings), + }, {}), }, }; } diff --git a/lib/types.ts b/lib/types.ts index a5f9ec3..45f1ab4 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -55,5 +55,5 @@ export type SettingsStateContextType = { }; export type SerializedSettingsState = Omit & { - keybindings: Record; + keybindings: Record; };