Skip to main content

Task <I, O>

Hierarchy

  • Deferred<O>
    • Task

Index

Constructors

publicconstructor

  • new Task<I, O>(input: I): Task<I, O>
  • Type parameters

    • I
    • O

    Parameters

    • input: I

    Returns Task<I, O>

Accessors

public[toStringTag]

  • get [toStringTag](): string
  • Returns string

publicinput

  • get input(): I
  • Returns I

state

  • get state(): DeferredState
  • Gets the current state of the deferred promise.

    @see

    Returns DeferredState

Methods

catch

  • catch<TResult>(onrejected?: null | (reason: unknown) => TResult | PromiseLike<TResult>): Promise<O | TResult>
  • Attaches a callback for only the rejection of the Promise.


    Type parameters

    • TResult = never

    Parameters

    • optionalonrejected: null | (reason: unknown) => TResult | PromiseLike<TResult>

      The callback to execute when the Promise is rejected.

      Returns Promise<O | TResult>

      A Promise for the completion of the callback.

    finally

    • finally(onfinally?: null | () => void): Promise<O>
    • Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.


      Parameters

      • optionalonfinally: null | () => void

        The callback to execute when the Promise is settled (fulfilled or rejected).

        Returns Promise<O>

        A Promise for the completion of the callback.

      reject

      • reject(reason?: any): void
      • Rejects the promise with a reason.


        Parameters

        • optionalreason: any

          The reason why the promise was rejected.

        Returns void

      resolve

      • resolve(value: O | PromiseLike<O>): void
      • Resolves the promise with a value or the result of another promise.


        Parameters

        • value: O | PromiseLike<O>

          The value to resolve the promise with.

        Returns void

      then

      • then<TResult1, TResult2>(onfulfilled?: null | (value: O) => TResult1 | PromiseLike<TResult1>, onrejected?: null | (reason: unknown) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>
      • Attaches callbacks for the resolution and/or rejection of the Promise.


        Type parameters

        • TResult1 = O
        • TResult2 = never

        Parameters

        • optionalonfulfilled: null | (value: O) => TResult1 | PromiseLike<TResult1>

          The callback to execute when the Promise is resolved.

          • optionalonrejected: null | (reason: unknown) => TResult2 | PromiseLike<TResult2>

            The callback to execute when the Promise is rejected.

            Returns Promise<TResult1 | TResult2>

            A Promise for the completion of which ever callback is executed.