export const renameKeys = < T extends Record < string , unknown > , U extends Record < string , unknown > > ( keysMap , obj ) : T => Object . keys ( obj ) . reduce ( ( acc , key ) => { return { ... acc , ... { [ keysMap [ key ] || key ] : obj [ key ] } , } ; } , { } as T ) ;