mobx-keystone 2.4.2 → 2.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobx-keystone",
3
- "version": "2.4.2",
3
+ "version": "2.4.3",
4
4
  "description": "A MobX powered state management solution based on data trees with first class support for TypeScript, snapshots, patches and much more",
5
5
  "keywords": [
6
6
  "mobx",
@@ -329,12 +329,20 @@ export function sharedInternalModel<
329
329
  // Copy static props from the base without reading its lazy snapshot processor
330
330
  // accessors. This keeps subclass declaration from compiling the parent model's
331
331
  // processor graph before snapshot processing is actually needed.
332
+ // Props are defined rather than assigned, since assigning fails for keys that are
333
+ // non-writable on Function.prototype (e.g. Symbol.metadata, added by standard
334
+ // decorators).
332
335
  for (const key of Reflect.ownKeys(base)) {
333
336
  if (key === "fromSnapshotProcessor" || key === "toSnapshotProcessor") {
334
337
  continue
335
338
  }
336
339
  if (Object.prototype.propertyIsEnumerable.call(base, key)) {
337
- ;(ThisModel as any)[key] = (base as any)[key]
340
+ Object.defineProperty(ThisModel, key, {
341
+ value: (base as any)[key],
342
+ writable: true,
343
+ enumerable: true,
344
+ configurable: true,
345
+ })
338
346
  }
339
347
  }
340
348
  delete (ThisModel as any)[modelUnwrappedClassSymbol]