inferred-types 1.0.1 → 1.1.1

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.
@@ -234,7 +234,8 @@ const COMPARISON_OPERATIONS = [
234
234
  "false",
235
235
  "returnEquals",
236
236
  "returnExtends",
237
- "isTemplateLiteral"
237
+ "isTemplateLiteral",
238
+ "hasLength"
238
239
  ];
239
240
 
240
241
  //#endregion
@@ -8694,6 +8695,10 @@ function handle_other(val, op, params) {
8694
8695
  if (!(val instanceof Error)) return false;
8695
8696
  if (!params[0]) return err(`invalid-params/errorsOfType`, `The 'errorsOfType' operation requires a type parameter`, { params });
8696
8697
  return "type" in val && val.type === params[0];
8698
+ case "hasLength": if (isString(val)) return isNarrowableArray(params) && contains(params, val.length);
8699
+ else if (isNumber(val)) return isNarrowableArray(params) && contains(params, `${val}`.length);
8700
+ else if (isArray(val)) return isNarrowableArray(params) && contains(params, val.length);
8701
+ else return false;
8697
8702
  case "returnEquals":
8698
8703
  if (!isFunction(val)) return false;
8699
8704
  return err(`compare/runtime`, `The comparison type "returnEquals" can not be evaluated in the runtime system!`);