@colyseus/schema 2.0.0 → 2.0.2

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.
@@ -1085,6 +1085,9 @@ function type(type, options = {}) {
1085
1085
  const context = options.context || globalContext;
1086
1086
  const constructor = target.constructor;
1087
1087
  constructor._context = context;
1088
+ if (!type) {
1089
+ throw new Error(`${constructor.name}: @type() reference provided for "${field}" is undefined. Make sure you don't have any circular dependencies.`);
1090
+ }
1088
1091
  /*
1089
1092
  * static schema
1090
1093
  */
@@ -2877,7 +2880,7 @@ class Schema {
2877
2880
  }
2878
2881
  }
2879
2882
  try {
2880
- $callbacks[change.field]?.forEach(callback => callback(change.value, change.previousValue));
2883
+ $callbacks[change.op]?.forEach(callback => callback(change.value, change.previousValue));
2881
2884
  }
2882
2885
  catch (e) {
2883
2886
  Schema.onError(e);