Skip to content

Commit 30f3804

Browse files
committed
chore: cleanup
1 parent 97d9cb1 commit 30f3804

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/SettingsContext.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import type {
66
SettingsStateContextType,
77
SerializedSettingsState,
88
KeyBindings,
9-
KeyCommand,
109
} from './types';
1110
import { defaultKeyBindings, commonKeyBindings } from './keybindings';
1211
import { usePersistToLocalStorage } from './persistence';
@@ -21,15 +20,15 @@ const initialState: SettingsState = {
2120
function serializeSettingsState(state: SettingsState): SerializedSettingsState {
2221
return {
2322
...state,
24-
keybindings: Object.entries(state.keybindings).reduce(
23+
keybindings: Object.entries(state.keybindings).reduce<Record<string, string>>(
2524
(acc, [key, value]) => {
2625
const commonName = Object.entries(commonKeyBindings).find(([_, v]) => v === value)?.[0];
2726
if (commonName) {
2827
acc[key] = commonName;
2928
}
3029
return acc;
3130
},
32-
{} as Record<string, string>,
31+
{},
3332
),
3433
};
3534
}
@@ -39,13 +38,13 @@ function deserializeSettingsState(state: SerializedSettingsState): SettingsState
3938
...state,
4039
keybindings: {
4140
...defaultKeyBindings,
42-
...Object.entries(state.keybindings).reduce((acc, [key, commonName]) => {
41+
...Object.entries(state.keybindings).reduce<KeyBindings>((acc, [key, commonName]) => {
4342
const commonBinding = commonKeyBindings[commonName as keyof typeof commonKeyBindings];
4443
if (commonBinding) {
4544
acc[key as keyof typeof defaultKeyBindings] = commonBinding;
4645
}
4746
return acc;
48-
}, {} as KeyBindings),
47+
}, {}),
4948
},
5049
};
5150
}

0 commit comments

Comments
 (0)