@ts-rust/std - v0.0.5
    Preparing search index...

    Function pendingOk

    • Creates a PendingResult<T, E> that resolves to Ok containing the awaited value.

      Takes a value or promise and wraps its resolved result in an Ok, ensuring the value type is Awaited to handle any PromiseLike input.

      Type Parameters

      • T

        The type of the input value or promise.

      • E

        The type of the potential error.

      Parameters

      • value: T | Promise<T>

        The value or promise to wrap in Ok.

      Returns PendingResult<Awaited<T>, Awaited<E>>

      A PendingResult resolving to Ok with the awaited value.

      const x = pendingOk<number, string>(42);
      const y = pendingOk<string, number>(Promise.resolve("hello"));

      expect(await x).toStrictEqual(ok(42));
      expect(await y).toStrictEqual(ok("hello"));