How to fix Type parameter 'K' is not assignable to keyof any in TypeScript | DevErrors