rimbu-org/rimbu

[Bug] `Deep.patch` and related methods have incorrect typing for multi-patch

vitoke opened this issue · 0 comments

The Deep.patch and related methods, have incorrect type inference for multi-part updates, for example in the following piece of code:

const person = {
  name: 'Alice',
  age: 34,
  address: {
    street: 'Random street',
    number: 45,
  },
  friends: ['Bob', 'Carol'],
};

Deep.patch(person, [
  {
    address: [{ street: 'ABC' }],
  },
  {
    name: 'James',  // <- the compiler will give an error here
  },
])

It seems that the compiler is inferring the type only from the first part of the patch.