@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.
- package/build/cjs/index.js +4 -1
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +4 -1
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +4 -1
- package/lib/Schema.js +1 -1
- package/lib/Schema.js.map +1 -1
- package/lib/annotations.js +3 -0
- package/lib/annotations.js.map +1 -1
- package/lib/codegen/languages/ts.js +1 -1
- package/lib/codegen/languages/ts.js.map +1 -1
- package/lib/codegen/types.js +14 -1
- package/lib/codegen/types.js.map +1 -1
- package/package.json +1 -1
package/build/esm/index.mjs
CHANGED
|
@@ -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.
|
|
2883
|
+
$callbacks[change.op]?.forEach(callback => callback(change.value, change.previousValue));
|
|
2881
2884
|
}
|
|
2882
2885
|
catch (e) {
|
|
2883
2886
|
Schema.onError(e);
|