File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ import type {
66 SettingsStateContextType ,
77 SerializedSettingsState ,
88 KeyBindings ,
9- KeyCommand ,
109} from './types' ;
1110import { defaultKeyBindings , commonKeyBindings } from './keybindings' ;
1211import { usePersistToLocalStorage } from './persistence' ;
@@ -21,15 +20,15 @@ const initialState: SettingsState = {
2120function 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}
Original file line number Diff line number Diff line change @@ -55,5 +55,5 @@ export type SettingsStateContextType = {
5555} ;
5656
5757export type SerializedSettingsState = Omit < SettingsState , 'keybindings' > & {
58- keybindings : Record < string , string | undefined > ;
58+ keybindings : Record < string , string > ;
5959} ;
You can’t perform that action at this time.
0 commit comments