@noego/trust 0.5.0-dev.3 → 0.5.0-dev.5

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.
@@ -2048,6 +2048,15 @@ var MISUSED_PROMISE_MESSAGES = {
2048
2048
  condition: "Promise used as a condition is always truthy; await it first.",
2049
2049
  "void-callback": "Async callback passed where a void-returning function is expected; its rejections are dropped \u2014 handle inside, or use a Promise-aware API."
2050
2050
  };
2051
+ var RESULT_CONDITION_RULE = "result-condition";
2052
+ var RESULT_CONDITION_ORIGIN = "condition";
2053
+ var RESULT_CONDITION_MESSAGE = "Result used as a condition is always truthy (Ok and Err are both objects); test `.ok` instead: `if (result.ok)` / `if (!result.ok)`.";
2054
+ var RESULT_LOOKALIKE_RULE = "result-lookalike";
2055
+ var RESULT_LOOKALIKE_ORIGIN = "declaration";
2056
+ var RESULT_LOOKALIKE_MESSAGE = 'Type "{{name}}" is a hand-written Result: it is told apart by `ok: true` / `ok: false` but is not @noego/trust\'s Result, so no rule follows its failure and nothing tells it from a real Result or an `{ ok, result }` envelope. Return Result<T, E> from @noego/trust inside the program; at an edge, decide the Result and return plain data with its own discriminant (`status`, `kind`).';
2057
+ function resultLookalikeMessage(name) {
2058
+ return fillMessage(RESULT_LOOKALIKE_MESSAGE, { name });
2059
+ }
2051
2060
  var TYPE_CLAIM_RULE = "type-claim";
2052
2061
  var TYPE_CLAIM_MESSAGES = {
2053
2062
  "claim:as": 'Type assertion claims "{{from}}" is "{{to}}", but "{{from}}" is not assignable to "{{to}}": nothing proves it. Narrow or validate the value instead.',
@@ -6993,6 +7002,12 @@ export {
6993
7002
  FLOATING_PROMISE_ORIGIN,
6994
7003
  FLOATING_PROMISE_MESSAGE,
6995
7004
  MISUSED_PROMISE_MESSAGES,
7005
+ RESULT_CONDITION_RULE,
7006
+ RESULT_CONDITION_ORIGIN,
7007
+ RESULT_CONDITION_MESSAGE,
7008
+ RESULT_LOOKALIKE_RULE,
7009
+ RESULT_LOOKALIKE_ORIGIN,
7010
+ resultLookalikeMessage,
6996
7011
  TYPE_CLAIM_RULE,
6997
7012
  TYPE_CLAIM_MESSAGES,
6998
7013
  ACCEPT_DIRECTIVE_MESSAGES,
@@ -7057,4 +7072,4 @@ export {
7057
7072
  readBaseline,
7058
7073
  describeBaselineDelta
7059
7074
  };
7060
- //# sourceMappingURL=chunk-PMIYTMMA.js.map
7075
+ //# sourceMappingURL=chunk-GJUWPZZJ.js.map