Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Result<R>

A Result represents a promise for the result of an async operation.

It implements the full ES6 Promise specification and is in all respects equivalent to a Promise.

Adapted from https://www.npmjs.com/package/@types/es6-promise

Type parameters

  • R

Hierarchy

  • Promise<R>
    • Result

Index

Properties

Methods

Properties

Promise

Promise: PromiseConstructor

__@toStringTag

__@toStringTag: "Promise"

Get the 'Promise' string tag

Methods

catch

  • catch<U>(rejected?: undefined | function): Promise<U>
  • Sugar for result.then(undefined, rejected)

    Type parameters

    • U

    Parameters

    • Optional rejected: undefined | function

    Returns Promise<U>

finally

  • finally<U>(onFinally?: undefined | function): Promise<U>
  • onFinally is invoked when/if the Result settles (either rejects or fullfils);

    Type parameters

    • U

    Parameters

    • Optional onFinally: undefined | function

      called when/if the Result settles

    Returns Promise<U>

then

  • then<U, V>(fullfilled?: null | function, rejected?: null | Callback<V> | Callback<void> | PromiseLike<V>): Promise<U>
  • Chain a Result.

    fullfilled is called when/if the Result resolves. rejected is called when/if the Result rejects.

    Both are optional, if either/both are omitted the next fullfilled/rejected in the chain is called. Both callbacks have a single parameter , the fullfilment value or rejection reason.

    Type parameters

    • U

    • V

    Parameters

    • Optional fullfilled: null | function

      the callback that is invoked when the Result is fullfilled

    • Optional rejected: null | Callback<V> | Callback<void> | PromiseLike<V>

      the callback that is invoked when the Result is rejected.

    Returns Promise<U>

    a new Result that resolves with the value you return from fullfilled/rejected. If an error is thrown in the callback, the returned promise rejects with that error.