immerjs/immer

Remove support for `this = draft` in recipes

mweststrate opened this issue · 2 comments

Currently, this is always equal to the draft inside recipes. I suggest to remove that. It has a few benefits:

  1. simpler typings
  2. simpler docs
  3. I didn't see anyone use it
  4. it makes pattern like this possible (note that we should make sure that the curried version does preserve this):
const context = {
  foo: 1,
  bar: produce(function(draft) {
    draft.foo = this.foo
  })
}

+1 to this

Done in the immer3 branch.