adopted-ember-addons / adopted-ember-addons/validated-changeset
getters/setters are executed against the original model, not the modified one
- 主要语言
- TypeScript
- 星标
- 38
- 派生
- 27
- PR 合并指标
- 30 天内没有已合并 PR
描述
Consider the following class:
```ts
class A {
foo = 1;
get bar(): number {
return 2 * this.foo;
}
set bar(value: number) {
this.foo = value / 2;
}
}
```
If you create a change buffer over an instance of this class and modify it:
```ts
changebuffer.set('foo', 2);
console.log(changebuffer.get('bar')); // 2, but I'd expect 4
changebuffer.set('bar', 6);
console.log(changebuffer.get('foo')); // 1, but I'd expect 3
```
the results are a bit unexpected. Would you consider getting the property descriptor
```ts
const descriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(target), prop);
```
and then executing it against the change buffer instance?
贡献指南
这个仓库没有索引到贡献指南
评估
这个 Issue 还没有评估数据。