mobx-state-tree 7.3.2 → 7.4.0

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.
@@ -7463,13 +7463,14 @@ function isRefinementType(type) {
7463
7463
  }
7464
7464
 
7465
7465
  /**
7466
- * `types.enumeration` - Can be used to create an string based enumeration.
7467
- * (note: this methods is just sugar for a union of string literals)
7466
+ * `types.enumeration` - Can be used to create a string or number based enumeration.
7467
+ * (note: this methods is just sugar for a union of string or number literals)
7468
7468
  *
7469
7469
  * Example:
7470
7470
  * ```ts
7471
7471
  * const TrafficLight = types.model({
7472
- * color: types.enumeration("Color", ["Red", "Orange", "Green"])
7472
+ * color: types.enumeration("Color", ["Red", "Orange", "Green"]),
7473
+ * speedLimit: types.enumeration("SpeedLimit", [30, 50])
7473
7474
  * })
7474
7475
  * ```
7475
7476
  *
@@ -7482,10 +7483,10 @@ function enumeration(name, options) {
7482
7483
  // check all options
7483
7484
  if (devMode()) {
7484
7485
  realOptions.forEach(function (option, i) {
7485
- assertIsString(option, i + 1);
7486
+ assertArg(option, function (o) { return typeof o === "string" || typeof o === "number"; }, "string or number", i + 1);
7486
7487
  });
7487
7488
  }
7488
- var type = union.apply(void 0, __spreadArray([], __read(realOptions.map(function (option) { return literal("" + option); })), false));
7489
+ var type = union.apply(void 0, __spreadArray([], __read(realOptions.map(function (option) { return literal(option); })), false));
7489
7490
  if (typeof name === "string")
7490
7491
  type.name = name;
7491
7492
  return type;