@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.
@@ -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)