(value: A[K])
| 272 | return new PropRefImpl(this, prop) |
| 273 | } |
| 274 | set(value: A[K]): AtomRef<A[K]> { |
| 275 | if (Array.isArray(this.parent.value)) { |
| 276 | const newArray = this.parent.value.slice() |
| 277 | newArray[this._prop as number] = value |
| 278 | this.parent.set(newArray as A) |
| 279 | } else { |
| 280 | this.parent.set({ |
| 281 | ...this.parent.value, |
| 282 | [this._prop]: value |
| 283 | }) |
| 284 | } |
| 285 | return this |
| 286 | } |
| 287 | update(f: (value: A[K]) => A[K]): AtomRef<A[K]> { |
| 288 | if (Array.isArray(this.parent.value)) { |
| 289 | const newArray = this.parent.value.slice() |