The value to check.
true
if the value is a PendingResult, narrowing to PendingResult<unknown, unknown>
.
const x = pendingResult(ok<number, string>(42));
const y = pendingResult(err<number, string>("failure"));
const z = ok(42); // Not a PendingResult
expect(isPendingResult(x)).toBe(true);
expect(isPendingResult(y)).toBe(true);
expect(isPendingResult(z)).toBe(false);
if (isPendingResult(x)) {
// Type narrowed to PendingResult<unknown, unknown>
expect(await x).toStrictEqual(ok(42));
}
Checks if a value is a PendingResult, narrowing its type to
PendingResult<unknown, unknown>
.This type guard verifies whether the input is a PendingResult, indicating it wraps a
Promise
resolving to a Result (either Ok or Err).