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