@colyseus/schema 2.0.9 → 2.0.11
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 +7 -0
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +7 -0
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +7 -0
- package/lib/codegen/languages/csharp.js +9 -5
- package/lib/codegen/languages/csharp.js.map +1 -1
- package/lib/types/ArraySchema.js +4 -0
- package/lib/types/ArraySchema.js.map +1 -1
- package/lib/types/MapSchema.js +3 -0
- package/lib/types/MapSchema.js.map +1 -1
- package/package.json +1 -1
- package/src/codegen/languages/csharp.ts +11 -5
- package/src/types/ArraySchema.ts +5 -0
- package/src/types/MapSchema.ts +4 -0
package/build/cjs/index.js
CHANGED
|
@@ -472,6 +472,10 @@ var ArraySchema = /** @class */ (function () {
|
|
|
472
472
|
};
|
|
473
473
|
ArraySchema.prototype.setAt = function (index, value) {
|
|
474
474
|
var _a, _b;
|
|
475
|
+
if (value === undefined || value === null) {
|
|
476
|
+
console.error("ArraySchema items cannot be null nor undefined; Use `deleteAt(index)` instead.");
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
475
479
|
if (value['$changes'] !== undefined) {
|
|
476
480
|
value['$changes'].setParent(this, this.$changes.root, index);
|
|
477
481
|
}
|
|
@@ -939,6 +943,9 @@ var MapSchema = /** @class */ (function () {
|
|
|
939
943
|
if (value === undefined || value === null) {
|
|
940
944
|
throw new Error("MapSchema#set('".concat(key, "', ").concat(value, "): trying to set ").concat(value, " value on '").concat(key, "'."));
|
|
941
945
|
}
|
|
946
|
+
// Force "key" as string
|
|
947
|
+
// See: https://github.com/colyseus/colyseus/issues/561#issuecomment-1646733468
|
|
948
|
+
key = key.toString();
|
|
942
949
|
// get "index" for this value.
|
|
943
950
|
var hasIndex = typeof (this.$changes.indexes[key]) !== "undefined";
|
|
944
951
|
var index = (hasIndex)
|