@types/bluebird

  • Version 3.5.42
  • Published
  • 61 kB
  • No dependencies
  • MIT license

Install

npm i @types/bluebird
yarn add @types/bluebird
pnpm add @types/bluebird

Overview

TypeScript definitions for bluebird

Index

Functions

function getNewLibraryCopy

getNewLibraryCopy: () => typeof Bluebird;
  • Returns a new independent copy of the Bluebird library.

    This method should be used before you use any of the methods which would otherwise alter the global Bluebird object - to avoid polluting global state.

function noConflict

noConflict: () => typeof Bluebird;
  • This is relevant to browser environments with no module loader.

    Release control of the Promise namespace to whatever it was before this library was loaded. Returns a reference to the library namespace so you can attach it to something else.

function setScheduler

setScheduler: (scheduler: (callback: (...args: any[]) => void) => void) => void;
  • Changes how bluebird schedules calls a-synchronously.

    Parameter scheduler

    Should be a function that asynchronously schedules the calling of the passed in function

Classes

class AggregateError

class AggregateError extends Error implements ArrayLike<Error> {}
  • A collection of errors. AggregateError is an array-like object, with numeric indices and a .length property. It supports all generic array methods such as .forEach directly.

    AggregateErrors are caught in .error handlers, even if the contained errors are not operational.

    Promise.some and Promise.any use AggregateError as rejection reason when they fail.

property length

length: number;

    method every

    every: (
    callback: (element: Error, index: number, array: AggregateError) => boolean,
    thisArg?: any
    ) => boolean;

      method filter

      filter: (
      callback: (element: Error, index: number, array: AggregateError) => boolean,
      thisArg?: any
      ) => AggregateError;

        method forEach

        forEach: (
        callback: (element: Error, index: number, array: AggregateError) => void,
        thisArg?: any
        ) => undefined;

          method indexOf

          indexOf: (searchElement: Error, fromIndex?: number) => number;

            method join

            join: (separator?: string) => string;

              method lastIndexOf

              lastIndexOf: (searchElement: Error, fromIndex?: number) => number;

                method map

                map: (
                callback: (element: Error, index: number, array: AggregateError) => boolean,
                thisArg?: any
                ) => AggregateError;

                  method pop

                  pop: () => Error;

                    method push

                    push: (...errors: Error[]) => number;

                      method reduce

                      reduce: (
                      callback: (
                      accumulator: any,
                      element: Error,
                      index: number,
                      array: AggregateError
                      ) => any,
                      initialValue?: any
                      ) => any;

                        method reduceRight

                        reduceRight: (
                        callback: (
                        previousValue: any,
                        element: Error,
                        index: number,
                        array: AggregateError
                        ) => any,
                        initialValue?: any
                        ) => any;

                          method reverse

                          reverse: () => AggregateError;

                            method shift

                            shift: () => Error;

                              method slice

                              slice: (begin?: number, end?: number) => AggregateError;

                                method some

                                some: (
                                callback: (element: Error, index: number, array: AggregateError) => boolean,
                                thisArg?: any
                                ) => boolean;

                                  method sort

                                  sort: (
                                  compareFunction?: (errLeft: Error, errRight: Error) => number
                                  ) => AggregateError;

                                    method unshift

                                    unshift: (...errors: Error[]) => number;

                                      class Bluebird

                                      class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {}

                                        constructor

                                        constructor(
                                        callback: (
                                        resolve: (thenableOrResult?: Resolvable<R>) => void,
                                        reject: (error?: any) => void,
                                        onCancel?: (callback: () => void) => void
                                        ) => void
                                        );
                                        • Create a new promise. The passed in function will receive functions resolve and reject as its arguments which can be called to seal the fate of the created promise.

                                          If promise cancellation is enabled, passed in function will receive one more function argument onCancel that allows to register an optional cancellation callback.

                                        property [Symbol.toStringTag]

                                        readonly [Symbol.toStringTag]: string;

                                          property caught

                                          caught: {
                                          <U = R>(onReject: (error: any) => Resolvable<U>): Bluebird<R | U>;
                                          <U, E1, E2, E3, E4, E5>(
                                          filter1: Constructor<E1>,
                                          filter2: Constructor<E2>,
                                          filter3: Constructor<E3>,
                                          filter4: Constructor<E4>,
                                          filter5: Constructor<E5>,
                                          onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable<U>
                                          ): Bluebird<R | U>;
                                          <U, E1, E2, E3, E4, E5>(
                                          filter1: Constructor<E1> | CatchFilter<E1>,
                                          filter2: Constructor<E2> | CatchFilter<E2>,
                                          filter3: Constructor<E3> | CatchFilter<E3>,
                                          filter4: Constructor<E4> | CatchFilter<E4>,
                                          filter5: Constructor<E5> | CatchFilter<E5>,
                                          onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable<U>
                                          ): Bluebird<R | U>;
                                          <U, E1, E2, E3, E4>(
                                          filter1: Constructor<E1>,
                                          filter2: Constructor<E2>,
                                          filter3: Constructor<E3>,
                                          filter4: Constructor<E4>,
                                          onReject: (error: E1 | E2 | E3 | E4) => Resolvable<U>
                                          ): Bluebird<R | U>;
                                          <U, E1, E2, E3, E4>(
                                          filter1: Constructor<E1> | CatchFilter<E1>,
                                          filter2: Constructor<E2> | CatchFilter<E2>,
                                          filter3: Constructor<E3> | CatchFilter<E3>,
                                          filter4: Constructor<E4> | CatchFilter<E4>,
                                          onReject: (error: E1 | E2 | E3 | E4) => Resolvable<U>
                                          ): Bluebird<R | U>;
                                          <U, E1, E2, E3>(
                                          filter1: Constructor<E1>,
                                          filter2: Constructor<E2>,
                                          filter3: Constructor<E3>,
                                          onReject: (error: E1 | E2 | E3) => Resolvable<U>
                                          ): Bluebird<R | U>;
                                          <U, E1, E2, E3>(
                                          filter1: Constructor<E1> | CatchFilter<E1>,
                                          filter2: Constructor<E2> | CatchFilter<E2>,
                                          filter3: Constructor<E3> | CatchFilter<E3>,
                                          onReject: (error: E1 | E2 | E3) => Resolvable<U>
                                          ): Bluebird<R | U>;
                                          <U, E1, E2>(
                                          filter1: Constructor<E1>,
                                          filter2: Constructor<E2>,
                                          onReject: (error: E1 | E2) => Resolvable<U>
                                          ): Bluebird<R | U>;
                                          <U, E1, E2>(
                                          filter1: Constructor<E1> | CatchFilter<E1>,
                                          filter2: Constructor<E2> | CatchFilter<E2>,
                                          onReject: (error: E1 | E2) => Resolvable<U>
                                          ): Bluebird<R | U>;
                                          <U, E1>(
                                          filter1: Constructor<E1>,
                                          onReject: (error: E1) => Resolvable<U>
                                          ): Bluebird<R | U>;
                                          <U, E1>(
                                          filter1: Constructor<E1> | CatchFilter<E1>,
                                          onReject: (error: E1) => Resolvable<U>
                                          ): Bluebird<R | U>;
                                          };
                                          • This is a catch-all exception handler, shortcut for calling .then(null, handler) on this promise.

                                            Any exception happening in a .then-chain will propagate to nearest .catch handler.

                                            Alias .caught(); for compatibility with earlier ECMAScript version.

                                          property lastly

                                          lastly: (handler: () => any) => Bluebird<R>;

                                            property Promise

                                            static Promise: typeof Bluebird;
                                            • Create a new promise. The passed in function will receive functions resolve and reject as its arguments which can be called to seal the fate of the created promise. If promise cancellation is enabled, passed in function will receive one more function argument onCancel that allows to register an optional cancellation callback.

                                            property version

                                            static version: string;
                                            • The version number of the library

                                            method all

                                            static all: {
                                            <T1, T2, T3, T4, T5>(
                                            values: [
                                            Resolvable<T1>,
                                            Resolvable<T2>,
                                            Resolvable<T3>,
                                            Resolvable<T4>,
                                            Resolvable<T5>
                                            ]
                                            ): Bluebird<[T1, T2, T3, T4, T5]>;
                                            <T1, T2, T3, T4>(
                                            values: [Resolvable<T1>, Resolvable<T2>, Resolvable<T3>, Resolvable<T4>]
                                            ): Bluebird<[T1, T2, T3, T4]>;
                                            <T1, T2, T3>(
                                            values: [Resolvable<T1>, Resolvable<T2>, Resolvable<T3>]
                                            ): Bluebird<[T1, T2, T3]>;
                                            <T1, T2>(values: [Resolvable<T1>, Resolvable<T2>]): Bluebird<[T1, T2]>;
                                            <T1>(values: [Resolvable<T1>]): Bluebird<[T1]>;
                                            <R>(values: Resolvable<Iterable<Resolvable<R>>>): Bluebird<R[]>;
                                            };
                                            • Same as calling Promise.all(thisPromise). With the exception that if this promise is bound to a value, the returned promise is bound to that value too.

                                            • Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are fulfilled. The promise's fulfillment value is an array with fulfillment values at respective positions to the original array. If any promise in the array rejects, the returned promise is rejected with the rejection reason.

                                            method allSettled

                                            static allSettled: {
                                            <T1, T2, T3, T4, T5>(
                                            values: [
                                            Resolvable<T1>,
                                            Resolvable<T2>,
                                            Resolvable<T3>,
                                            Resolvable<T4>,
                                            Resolvable<T5>
                                            ]
                                            ): Bluebird<
                                            [
                                            Bluebird.Inspection<T1>,
                                            Bluebird.Inspection<T2>,
                                            Bluebird.Inspection<T3>,
                                            Bluebird.Inspection<T4>,
                                            Bluebird.Inspection<T5>
                                            ]
                                            >;
                                            <T1, T2, T3, T4>(
                                            values: [Resolvable<T1>, Resolvable<T2>, Resolvable<T3>, Resolvable<T4>]
                                            ): Bluebird<
                                            [
                                            Bluebird.Inspection<T1>,
                                            Bluebird.Inspection<T2>,
                                            Bluebird.Inspection<T3>,
                                            Bluebird.Inspection<T4>
                                            ]
                                            >;
                                            <T1, T2, T3>(
                                            values: [Resolvable<T1>, Resolvable<T2>, Resolvable<T3>]
                                            ): Bluebird<
                                            [
                                            Bluebird.Inspection<T1>,
                                            Bluebird.Inspection<T2>,
                                            Bluebird.Inspection<T3>
                                            ]
                                            >;
                                            <T1, T2>(values: [Resolvable<T1>, Resolvable<T2>]): Bluebird<
                                            [Bluebird.Inspection<T1>, Bluebird.Inspection<T2>]
                                            >;
                                            <T1>(values: [Resolvable<T1>]): Bluebird<[Bluebird.Inspection<T1>]>;
                                            <R>(values: Resolvable<Iterable<Resolvable<R>>>): Bluebird<
                                            Bluebird.Inspection<R>[]
                                            >;
                                            };

                                              method any

                                              static any: <R>(values: Resolvable<Iterable<Resolvable<R>>>) => Bluebird<R>;
                                              • Same as calling Promise.any(thisPromise). With the exception that if this promise is bound to a value, the returned promise is bound to that value too.

                                              • Like Promise.some(), with 1 as count. However, if the promise fulfills, the fulfillment value is not an array of 1 but the value directly.

                                              method asCallback

                                              asCallback: {
                                              (
                                              callback: (err: any, value?: R) => void,
                                              options?: Bluebird.SpreadOption
                                              ): this;
                                              (...sink: any[]): this;
                                              };

                                                method attempt

                                                static attempt: <R>(fn: () => Resolvable<R>) => Bluebird<R>;

                                                  method bind

                                                  static bind: (thisArg: any) => Bluebird<void>;
                                                  • Create a promise that follows this promise, but is bound to the given thisArg value. A bound promise will call its handlers with the bound value set to this.

                                                    Additionally promises derived from a bound promise will also be bound promises with the same thisArg binding as the original promise.

                                                  • Sugar for Promise.resolve(undefined).bind(thisArg);. See .bind().

                                                  method call

                                                  call: <U extends keyof Q, Q>(
                                                  this: Bluebird<Q>,
                                                  propertyName: U,
                                                  ...args: any[]
                                                  ) => Bluebird<Q[U] extends (...args: any[]) => any ? ReturnType<Q[U]> : never>;
                                                  • This is a convenience method for doing:

                                                    promise.then(function(obj){ return obj[propertyName].call(obj, arg...); });

                                                  method cancel

                                                  cancel: () => void;
                                                  • Cancel this promise. Will not do anything if this promise is already settled or if the cancellation feature has not been enabled

                                                  method cast

                                                  static cast: <R>(value: Resolvable<R>) => Bluebird<R>;
                                                  • Cast the given value to a trusted promise.

                                                    If value is already a trusted Promise, it is returned as is. If value is not a thenable, a fulfilled is: Promise returned with value as its fulfillment value. If value is a thenable (Promise-like object, like those returned by jQuery's $.ajax), returns a trusted that: Promise assimilates the state of the thenable.

                                                  method catch

                                                  catch: {
                                                  <U = R>(onReject: (error: any) => Resolvable<U>): Bluebird<U | R>;
                                                  <U, E1, E2, E3, E4, E5>(
                                                  filter1: Constructor<E1>,
                                                  filter2: Constructor<E2>,
                                                  filter3: Constructor<E3>,
                                                  filter4: Constructor<E4>,
                                                  filter5: Constructor<E5>,
                                                  onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable<U>
                                                  ): Bluebird<R | U>;
                                                  <U, E1, E2, E3, E4, E5>(
                                                  filter1: Constructor<E1> | CatchFilter<E1>,
                                                  filter2: Constructor<E2> | CatchFilter<E2>,
                                                  filter3: Constructor<E3> | CatchFilter<E3>,
                                                  filter4: Constructor<E4> | CatchFilter<E4>,
                                                  filter5: Constructor<E5> | CatchFilter<E5>,
                                                  onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable<U>
                                                  ): Bluebird<R | U>;
                                                  <U, E1, E2, E3, E4>(
                                                  filter1: Constructor<E1>,
                                                  filter2: Constructor<E2>,
                                                  filter3: Constructor<E3>,
                                                  filter4: Constructor<E4>,
                                                  onReject: (error: E1 | E2 | E3 | E4) => Resolvable<U>
                                                  ): Bluebird<R | U>;
                                                  <U, E1, E2, E3, E4>(
                                                  filter1: Constructor<E1> | CatchFilter<E1>,
                                                  filter2: Constructor<E2> | CatchFilter<E2>,
                                                  filter3: Constructor<E3> | CatchFilter<E3>,
                                                  filter4: Constructor<E4> | CatchFilter<E4>,
                                                  onReject: (error: E1 | E2 | E3 | E4) => Resolvable<U>
                                                  ): Bluebird<R | U>;
                                                  <U, E1, E2, E3>(
                                                  filter1: Constructor<E1>,
                                                  filter2: Constructor<E2>,
                                                  filter3: Constructor<E3>,
                                                  onReject: (error: E1 | E2 | E3) => Resolvable<U>
                                                  ): Bluebird<R | U>;
                                                  <U, E1, E2, E3>(
                                                  filter1: Constructor<E1> | CatchFilter<E1>,
                                                  filter2: Constructor<E2> | CatchFilter<E2>,
                                                  filter3: Constructor<E3> | CatchFilter<E3>,
                                                  onReject: (error: E1 | E2 | E3) => Resolvable<U>
                                                  ): Bluebird<R | U>;
                                                  <U, E1, E2>(
                                                  filter1: Constructor<E1>,
                                                  filter2: Constructor<E2>,
                                                  onReject: (error: E1 | E2) => Resolvable<U>
                                                  ): Bluebird<R | U>;
                                                  <U, E1, E2>(
                                                  filter1: Constructor<E1> | CatchFilter<E1>,
                                                  filter2: Constructor<E2> | CatchFilter<E2>,
                                                  onReject: (error: E1 | E2) => Resolvable<U>
                                                  ): Bluebird<R | U>;
                                                  <U, E1>(
                                                  filter1: Constructor<E1>,
                                                  onReject: (error: E1) => Resolvable<U>
                                                  ): Bluebird<R | U>;
                                                  <U, E1>(
                                                  filter1: Constructor<E1> | CatchFilter<E1>,
                                                  onReject: (error: E1) => Resolvable<U>
                                                  ): Bluebird<R | U>;
                                                  };
                                                  • This is a catch-all exception handler, shortcut for calling .then(null, handler) on this promise.

                                                    Any exception happening in a .then-chain will propagate to nearest .catch handler.

                                                    Alias .caught(); for compatibility with earlier ECMAScript version.

                                                  • This extends .catch to work more like catch-clauses in languages like Java or C#.

                                                    Instead of manually checking instanceof or .name === "SomeError", you may specify a number of error constructors which are eligible for this catch handler. The catch handler that is first met that has eligible constructors specified, is the one that will be called.

                                                    This method also supports predicate-based filters. If you pass a predicate function instead of an error constructor, the predicate will receive the error as an argument. The return result of the predicate will be used determine whether the error handler should be called.

                                                    Alias .caught(); for compatibility with earlier ECMAScript version.

                                                  method catchReturn

                                                  catchReturn: {
                                                  <U>(value: U): Bluebird<R | U>;
                                                  <U>(
                                                  filter1: Constructor<Error>,
                                                  filter2: Constructor<Error>,
                                                  filter3: Constructor<Error>,
                                                  filter4: Constructor<Error>,
                                                  filter5: Constructor<Error>,
                                                  value: U
                                                  ): Bluebird<R | U>;
                                                  <U>(
                                                  filter1: Constructor<Error> | CatchFilter<Error>,
                                                  filter2: Constructor<Error> | CatchFilter<Error>,
                                                  filter3: Constructor<Error> | CatchFilter<Error>,
                                                  filter4: Constructor<Error> | CatchFilter<Error>,
                                                  filter5: Constructor<Error> | CatchFilter<Error>,
                                                  value: U
                                                  ): Bluebird<R | U>;
                                                  <U>(
                                                  filter1: Constructor<Error>,
                                                  filter2: Constructor<Error>,
                                                  filter3: Constructor<Error>,
                                                  filter4: Constructor<Error>,
                                                  value: U
                                                  ): Bluebird<R | U>;
                                                  <U>(
                                                  filter1: Constructor<Error> | CatchFilter<Error>,
                                                  filter2: Constructor<Error> | CatchFilter<Error>,
                                                  filter3: Constructor<Error> | CatchFilter<Error>,
                                                  filter4: Constructor<Error> | CatchFilter<Error>,
                                                  value: U
                                                  ): Bluebird<R | U>;
                                                  <U>(
                                                  filter1: Constructor<Error>,
                                                  filter2: Constructor<Error>,
                                                  filter3: Constructor<Error>,
                                                  value: U
                                                  ): Bluebird<R | U>;
                                                  <U>(
                                                  filter1: Constructor<Error> | CatchFilter<Error>,
                                                  filter2: Constructor<Error> | CatchFilter<Error>,
                                                  filter3: Constructor<Error> | CatchFilter<Error>,
                                                  value: U
                                                  ): Bluebird<R | U>;
                                                  <U>(
                                                  filter1: Constructor<Error>,
                                                  filter2: Constructor<Error>,
                                                  value: U
                                                  ): Bluebird<R | U>;
                                                  <U>(
                                                  filter1: Constructor<Error> | CatchFilter<Error>,
                                                  filter2: Constructor<Error> | CatchFilter<Error>,
                                                  value: U
                                                  ): Bluebird<R | U>;
                                                  <U>(filter1: Constructor<Error>, value: U): Bluebird<R | U>;
                                                  <U>(filter1: Constructor<Error> | CatchFilter<Error>, value: U): Bluebird<
                                                  R | U
                                                  >;
                                                  };
                                                  • Convenience method for:

                                                    .catch(function() { return value; });

                                                    in the case where value doesn't change its value. That means value is bound at the time of calling .catchReturn()

                                                  method catchThrow

                                                  catchThrow: {
                                                  (reason: Error): Bluebird<R>;
                                                  (
                                                  filter1: Constructor<Error>,
                                                  filter2: Constructor<Error>,
                                                  filter3: Constructor<Error>,
                                                  filter4: Constructor<Error>,
                                                  filter5: Constructor<Error>,
                                                  reason: Error
                                                  ): Bluebird<R>;
                                                  (
                                                  filter1: Constructor<Error> | CatchFilter<Error>,
                                                  filter2: Constructor<Error> | CatchFilter<Error>,
                                                  filter3: Constructor<Error> | CatchFilter<Error>,
                                                  filter4: Constructor<Error> | CatchFilter<Error>,
                                                  filter5: Constructor<Error> | CatchFilter<Error>,
                                                  reason: Error
                                                  ): Bluebird<R>;
                                                  (
                                                  filter1: Constructor<Error>,
                                                  filter2: Constructor<Error>,
                                                  filter3: Constructor<Error>,
                                                  filter4: Constructor<Error>,
                                                  reason: Error
                                                  ): Bluebird<R>;
                                                  (
                                                  filter1: Constructor<Error> | CatchFilter<Error>,
                                                  filter2: Constructor<Error> | CatchFilter<Error>,
                                                  filter3: Constructor<Error> | CatchFilter<Error>,
                                                  filter4: Constructor<Error> | CatchFilter<Error>,
                                                  reason: Error
                                                  ): Bluebird<R>;
                                                  (
                                                  filter1: Constructor<Error>,
                                                  filter2: Constructor<Error>,
                                                  filter3: Constructor<Error>,
                                                  reason: Error
                                                  ): Bluebird<R>;
                                                  (
                                                  filter1: Constructor<Error> | CatchFilter<Error>,
                                                  filter2: Constructor<Error> | CatchFilter<Error>,
                                                  filter3: Constructor<Error> | CatchFilter<Error>,
                                                  reason: Error
                                                  ): Bluebird<R>;
                                                  (
                                                  filter1: Constructor<Error>,
                                                  filter2: Constructor<Error>,
                                                  reason: Error
                                                  ): Bluebird<R>;
                                                  (
                                                  filter1: Constructor<Error> | CatchFilter<Error>,
                                                  filter2: Constructor<Error> | CatchFilter<Error>,
                                                  reason: Error
                                                  ): Bluebird<R>;
                                                  (filter1: Constructor<Error>, reason: Error): Bluebird<R>;
                                                  (
                                                  filter1: Constructor<Error> | CatchFilter<Error>,
                                                  reason: Error
                                                  ): Bluebird<R>;
                                                  };
                                                  • Convenience method for:

                                                    .catch(function() { throw reason; }); Same limitations apply as with .catchReturn().

                                                  method config

                                                  static config: (options: {
                                                  warnings?: boolean | { wForgottenReturn: boolean } | undefined;
                                                  longStackTraces?: boolean | undefined;
                                                  cancellation?: boolean | undefined;
                                                  monitoring?: boolean | undefined;
                                                  asyncHooks?: boolean | undefined;
                                                  }) => void;
                                                  • Configure long stack traces, warnings, monitoring and cancellation. Note that even though false is the default here, a development environment might be detected which automatically enables long stack traces and warnings.

                                                  method coroutine

                                                  static coroutine: {
                                                  <T>(
                                                  generatorFunction: () => IterableIterator<any>,
                                                  options?: Bluebird.CoroutineOptions
                                                  ): () => Bluebird<T>;
                                                  <T, A1>(
                                                  generatorFunction: (a1: A1) => IterableIterator<any>,
                                                  options?: Bluebird.CoroutineOptions
                                                  ): (a1: A1) => Bluebird<T>;
                                                  <T, A1, A2>(
                                                  generatorFunction: (a1: A1, a2: A2) => IterableIterator<any>,
                                                  options?: Bluebird.CoroutineOptions
                                                  ): (a1: A1, a2: A2) => Bluebird<T>;
                                                  <T, A1, A2, A3>(
                                                  generatorFunction: (a1: A1, a2: A2, a3: A3) => IterableIterator<any>,
                                                  options?: Bluebird.CoroutineOptions
                                                  ): (a1: A1, a2: A2, a3: A3) => Bluebird<T>;
                                                  <T, A1, A2, A3, A4>(
                                                  generatorFunction: (
                                                  a1: A1,
                                                  a2: A2,
                                                  a3: A3,
                                                  a4: A4
                                                  ) => IterableIterator<any>,
                                                  options?: Bluebird.CoroutineOptions
                                                  ): (a1: A1, a2: A2, a3: A3, a4: A4) => Bluebird<T>;
                                                  <T, A1, A2, A3, A4, A5>(
                                                  generatorFunction: (
                                                  a1: A1,
                                                  a2: A2,
                                                  a3: A3,
                                                  a4: A4,
                                                  a5: A5
                                                  ) => IterableIterator<any>,
                                                  options?: Bluebird.CoroutineOptions
                                                  ): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) => Bluebird<T>;
                                                  <T, A1, A2, A3, A4, A5, A6>(
                                                  generatorFunction: (
                                                  a1: A1,
                                                  a2: A2,
                                                  a3: A3,
                                                  a4: A4,
                                                  a5: A5,
                                                  a6: A6
                                                  ) => IterableIterator<any>,
                                                  options?: Bluebird.CoroutineOptions
                                                  ): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6) => Bluebird<T>;
                                                  <T, A1, A2, A3, A4, A5, A6, A7>(
                                                  generatorFunction: (
                                                  a1: A1,
                                                  a2: A2,
                                                  a3: A3,
                                                  a4: A4,
                                                  a5: A5,
                                                  a6: A6,
                                                  a7: A7
                                                  ) => IterableIterator<any>,
                                                  options?: Bluebird.CoroutineOptions
                                                  ): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7) => Bluebird<T>;
                                                  <T, A1, A2, A3, A4, A5, A6, A7, A8>(
                                                  generatorFunction: (
                                                  a1: A1,
                                                  a2: A2,
                                                  a3: A3,
                                                  a4: A4,
                                                  a5: A5,
                                                  a6: A6,
                                                  a7: A7,
                                                  a8: A8
                                                  ) => IterableIterator<any>,
                                                  options?: Bluebird.CoroutineOptions
                                                  ): (
                                                  a1: A1,
                                                  a2: A2,
                                                  a3: A3,
                                                  a4: A4,
                                                  a5: A5,
                                                  a6: A6,
                                                  a7: A7,
                                                  a8: A8
                                                  ) => Bluebird<T>;
                                                  };
                                                  • Returns a function that can use yield to run asynchronous code synchronously.

                                                    This feature requires the support of generators which are drafted in the next version of the language. Node version greater than 0.11.2 is required and needs to be executed with the --harmony-generators (or --harmony) command-line switch.

                                                  method defer

                                                  static defer: <R>() => Bluebird.Resolver<R>;
                                                  • See Also

                                                    • http://bluebirdjs.com/docs/deprecated-apis.html#promise-resolution

                                                    Deprecated

                                                    Create a promise with undecided fate and return a PromiseResolver to control it. See resolution?: Promise(#promise-resolution).

                                                  method delay

                                                  static delay: {
                                                  <R>(ms: number, value: Resolvable<R>): Bluebird<R>;
                                                  (ms: number): Bluebird<void>;
                                                  };
                                                  • Same as calling Promise.delay(ms, this).

                                                  • Returns a promise that will be resolved with value (or undefined) after given ms milliseconds. If value is a promise, the delay will start counting down when it is fulfilled and the returned promise will be fulfilled with the fulfillment value of the value promise.

                                                  method disposer

                                                  disposer: (
                                                  disposeFn: (arg: R, promise: Bluebird<R>) => Resolvable<void>
                                                  ) => Bluebird.Disposer<R>;
                                                  • A meta method used to specify the disposer method that cleans up a resource when using Promise.using.

                                                    Returns a Disposer object which encapsulates both the resource as well as the method to clean it up. The user can pass this object to Promise.using to get access to the resource when it becomes available, as well as to ensure its automatically cleaned up.

                                                    The second argument passed to a disposer is the result promise of the using block, which you can inspect synchronously.

                                                  method done

                                                  done: <U>(
                                                  onFulfilled?: (value: R) => Resolvable<U>,
                                                  onRejected?: (error: any) => Resolvable<U>
                                                  ) => void;
                                                  • Like .then(), but any unhandled rejection that ends up here will be thrown as an error.

                                                  method each

                                                  static each: <R>(
                                                  values: Resolvable<Iterable<Resolvable<R>>>,
                                                  iterator: IterateFunction<R, any>
                                                  ) => Bluebird<R[]>;
                                                  • Same as calling ``Bluebird.each(thisPromise, iterator)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.

                                                  • Iterate over an array, or a promise of an array, which contains promises (or a mix of promises and values) with the given iterator function with the signature (item, index, value) where item is the resolved value of a respective promise in the input array. Iteration happens serially. If any promise in the input array is rejected the returned promise is rejected as well.

                                                    Resolves to the original array unmodified, this method is meant to be used for side effects. If the iterator function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration.

                                                  method error

                                                  error: <U>(onReject: (reason: any) => Resolvable<U>) => Bluebird<U>;
                                                  • Like .catch but instead of catching all types of exceptions, it only catches those that don't originate from thrown errors but rather from explicit rejections.

                                                  method filter

                                                  static filter: <R>(
                                                  values: Resolvable<Iterable<Resolvable<R>>>,
                                                  filterer: IterateFunction<R, boolean>,
                                                  option?: Bluebird.ConcurrencyOption
                                                  ) => Bluebird<R[]>;
                                                  • Same as calling ``Promise.filter(thisPromise, filterer)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.

                                                  • Filter an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given filterer function with the signature (item, index, arrayLength) where item is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well.

                                                    The return values from the filtered functions are coerced to booleans, with the exception of promises and thenables which are awaited for their eventual result.

                                                    *The original array is not modified.

                                                  method finally

                                                  finally: (handler: () => Resolvable<any>) => Bluebird<R>;
                                                  • Pass a handler that will be called regardless of this promise's fate. Returns a new promise chained from this promise.

                                                    There are special semantics for .finally() in that the final value cannot be modified from the handler.

                                                    Alias .lastly(); for compatibility with earlier ECMAScript version.

                                                  method fromCallback

                                                  static fromCallback: <T>(
                                                  resolver: (callback: (err: any, result?: T) => void) => void,
                                                  options?: Bluebird.FromNodeOptions
                                                  ) => Bluebird<T>;

                                                    method fromNode

                                                    static fromNode: <T>(
                                                    resolver: (callback: (err: any, result?: T) => void) => void,
                                                    options?: Bluebird.FromNodeOptions
                                                    ) => Bluebird<T>;
                                                    • Returns a promise that is resolved by a node style callback function.

                                                    method get

                                                    get: <U extends keyof R>(key: U) => Bluebird<R[U]>;
                                                    • This is a convenience method for doing:

                                                      promise.then(function(obj){ return obj[propertyName]; });

                                                    method is

                                                    static is: (value: any) => boolean;
                                                    • See if value is a trusted Promise.

                                                    method isCancelled

                                                    isCancelled: () => boolean;
                                                    • See if this promise has been cancelled.

                                                    method isFulfilled

                                                    isFulfilled: () => boolean;
                                                    • See if this promise has been fulfilled.

                                                    method isPending

                                                    isPending: () => boolean;
                                                    • See if this promise is still defer.

                                                    method isRejected

                                                    isRejected: () => boolean;
                                                    • See if this promise has been rejected.

                                                    method isResolved

                                                    isResolved: () => boolean;
                                                    • See if this promise is resolved -> either fulfilled or rejected.

                                                    method join

                                                    static join: {
                                                    <R, A1>(
                                                    arg1: Resolvable<A1>,
                                                    handler: (arg1: A1) => Resolvable<R>
                                                    ): Bluebird<R>;
                                                    <R, A1, A2>(
                                                    arg1: Resolvable<A1>,
                                                    arg2: Resolvable<A2>,
                                                    handler: (arg1: A1, arg2: A2) => Resolvable<R>
                                                    ): Bluebird<R>;
                                                    <R, A1, A2, A3>(
                                                    arg1: Resolvable<A1>,
                                                    arg2: Resolvable<A2>,
                                                    arg3: Resolvable<A3>,
                                                    handler: (arg1: A1, arg2: A2, arg3: A3) => Resolvable<R>
                                                    ): Bluebird<R>;
                                                    <R, A1, A2, A3, A4>(
                                                    arg1: Resolvable<A1>,
                                                    arg2: Resolvable<A2>,
                                                    arg3: Resolvable<A3>,
                                                    arg4: Resolvable<A4>,
                                                    handler: (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Resolvable<R>
                                                    ): Bluebird<R>;
                                                    <R, A1, A2, A3, A4, A5>(
                                                    arg1: Resolvable<A1>,
                                                    arg2: Resolvable<A2>,
                                                    arg3: Resolvable<A3>,
                                                    arg4: Resolvable<A4>,
                                                    arg5: Resolvable<A5>,
                                                    handler: (
                                                    arg1: A1,
                                                    arg2: A2,
                                                    arg3: A3,
                                                    arg4: A4,
                                                    arg5: A5
                                                    ) => Resolvable<R>
                                                    ): Bluebird<R>;
                                                    <R>(...values: Resolvable<R>[]): Bluebird<R[]>;
                                                    };
                                                    • Promise.join( Promise|any values..., function handler ) -> Promise For coordinating multiple concurrent discrete promises.

                                                      Note: In 1.x and 0.x Promise.join used to be a Promise.all that took the values in as arguments instead in an array. This behavior has been deprecated but is still supported partially - when the last argument is an immediate function value the new semantics will apply

                                                    • Deprecated

                                                      use .all instead

                                                    method longStackTraces

                                                    static longStackTraces: () => void;
                                                    • Call this right after the library is loaded to enabled long stack traces.

                                                      Long stack traces cannot be disabled after being enabled, and cannot be enabled after promises have already been created. Long stack traces imply a substantial performance penalty, around 4-5x for throughput and 0.5x for latency.

                                                    method map

                                                    static map: <R, U>(
                                                    values: Resolvable<Iterable<Resolvable<R>>>,
                                                    mapper: IterateFunction<R, U>,
                                                    options?: Bluebird.ConcurrencyOption
                                                    ) => Bluebird<U[]>;
                                                    • Same as calling Bluebird.map(thisPromise, mapper). With the exception that if this promise is bound to a value, the returned promise is bound to that value too.

                                                    • Map an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given mapper function with the signature (item, index, arrayLength) where item is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well.

                                                      If the mapper function returns promises or thenables, the returned promise will wait for all the mapped results to be resolved as well.

                                                      *The original array is not modified.*

                                                    method mapSeries

                                                    static mapSeries: <R, U>(
                                                    values: Resolvable<Iterable<Resolvable<R>>>,
                                                    iterator: IterateFunction<R, U>
                                                    ) => Bluebird<U[]>;
                                                    • Same as calling ``Bluebird.mapSeries(thisPromise, iterator)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.

                                                    • Given an Iterable(arrays are Iterable), or a promise of an Iterable, which produces promises (or a mix of promises and values), iterate over all the values in the Iterable into an array and iterate over the array serially, in-order.

                                                      Returns a promise for an array that contains the values returned by the iterator function in their respective positions. The iterator won't be called for an item until its previous item, and the promise returned by the iterator for that item are fulfilled. This results in a mapSeries kind of utility but it can also be used simply as a side effect iterator similar to Array#forEach.

                                                      If any promise in the input array is rejected or any promise returned by the iterator function is rejected, the result will be rejected as well.

                                                    method method

                                                    static method: {
                                                    <R>(fn: () => Resolvable<R>): () => Bluebird<R>;
                                                    <R, A1>(fn: (arg1: A1) => Resolvable<R>): (arg1: A1) => Bluebird<R>;
                                                    <R, A1, A2>(fn: (arg1: A1, arg2: A2) => Resolvable<R>): (
                                                    arg1: A1,
                                                    arg2: A2
                                                    ) => Bluebird<R>;
                                                    <R, A1, A2, A3>(fn: (arg1: A1, arg2: A2, arg3: A3) => Resolvable<R>): (
                                                    arg1: A1,
                                                    arg2: A2,
                                                    arg3: A3
                                                    ) => Bluebird<R>;
                                                    <R, A1, A2, A3, A4>(
                                                    fn: (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Resolvable<R>
                                                    ): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Bluebird<R>;
                                                    <R, A1, A2, A3, A4, A5>(
                                                    fn: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Resolvable<R>
                                                    ): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Bluebird<R>;
                                                    <R>(fn: (...args: any[]) => Resolvable<R>): (...args: any[]) => Bluebird<R>;
                                                    };
                                                    • Returns a new function that wraps the given function fn. The new function will always return a promise that is fulfilled with the original functions return values or rejected with thrown exceptions from the original function. This method is convenient when a function can sometimes return synchronously or throw synchronously.

                                                    method nodeify

                                                    nodeify: {
                                                    (
                                                    callback: (err: any, value?: R) => void,
                                                    options?: Bluebird.SpreadOption
                                                    ): this;
                                                    (...sink: any[]): this;
                                                    };
                                                    • Register a node-style callback on this promise.

                                                      When this promise is is either fulfilled or rejected, the node callback will be called back with the node.js convention where error reason is the first argument and success value is the second argument.

                                                      The error argument will be null in case of success. If the callback argument is not a function, this method does not do anything.

                                                    method onPossiblyUnhandledRejection

                                                    static onPossiblyUnhandledRejection: {
                                                    (handler: (reason: any) => any): void;
                                                    (handler?: (error: Error, promise: Bluebird<any>) => void): void;
                                                    };
                                                    • Add handler as the handler to call when there is a possibly unhandled rejection. The default handler logs the error stack to stderr or console.error in browsers.

                                                      Passing no value or a non-function will have the effect of removing any kind of handling for possibly unhandled rejections.

                                                    • Add handler as the handler to call when there is a possibly unhandled rejection. The default handler logs the error stack to stderr or console.error in browsers.

                                                      Passing no value or a non-function will have the effect of removing any kind of handling for possibly unhandled rejections.

                                                      Note: this hook is specific to the bluebird instance its called on, application developers should use global rejection events.

                                                    method promisify

                                                    static promisify: {
                                                    <T>(
                                                    func: (callback: (err: any, result?: T) => void) => void,
                                                    options?: Bluebird.PromisifyOptions
                                                    ): () => Bluebird<T>;
                                                    <T, A1>(
                                                    func: (arg1: A1, callback: (err: any, result?: T) => void) => void,
                                                    options?: Bluebird.PromisifyOptions
                                                    ): (arg1: A1) => Bluebird<T>;
                                                    <T, A1, A2>(
                                                    func: (
                                                    arg1: A1,
                                                    arg2: A2,
                                                    callback: (err: any, result?: T) => void
                                                    ) => void,
                                                    options?: Bluebird.PromisifyOptions
                                                    ): (arg1: A1, arg2: A2) => Bluebird<T>;
                                                    <T, A1, A2, A3>(
                                                    func: (
                                                    arg1: A1,
                                                    arg2: A2,
                                                    arg3: A3,
                                                    callback: (err: any, result?: T) => void
                                                    ) => void,
                                                    options?: Bluebird.PromisifyOptions
                                                    ): (arg1: A1, arg2: A2, arg3: A3) => Bluebird<T>;
                                                    <T, A1, A2, A3, A4>(
                                                    func: (
                                                    arg1: A1,
                                                    arg2: A2,
                                                    arg3: A3,
                                                    arg4: A4,
                                                    callback: (err: any, result?: T) => void
                                                    ) => void,
                                                    options?: Bluebird.PromisifyOptions
                                                    ): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Bluebird<T>;
                                                    <T, A1, A2, A3, A4, A5>(
                                                    func: (
                                                    arg1: A1,
                                                    arg2: A2,
                                                    arg3: A3,
                                                    arg4: A4,
                                                    arg5: A5,
                                                    callback: (err: any, result?: T) => void
                                                    ) => void,
                                                    options?: Bluebird.PromisifyOptions
                                                    ): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Bluebird<T>;
                                                    (
                                                    nodeFunction: (...args: any[]) => void,
                                                    options?: Bluebird.PromisifyOptions
                                                    ): (...args: any[]) => Bluebird<any>;
                                                    };
                                                    • Returns a function that will wrap the given nodeFunction.

                                                      Instead of taking a callback, the returned function will return a promise whose fate is decided by the callback behavior of the given node function. The node function should conform to node.js convention of accepting a callback as last argument and calling that callback with error as the first argument and success value on the second argument.

                                                      If the nodeFunction calls its callback with multiple success values, the fulfillment value will be an array of them.

                                                      If you pass a receiver, the nodeFunction will be called as a method on the receiver.

                                                    method promisifyAll

                                                    static promisifyAll: <T extends object>(
                                                    target: T,
                                                    options?: Bluebird.PromisifyAllOptions<T>
                                                    ) => PromisifyAll<T>;
                                                    • Promisifies the entire object by going through the object's properties and creating an async equivalent of each function on the object and its prototype chain.

                                                      The promisified method name will be the original method name postfixed with Async. Returns the input object.

                                                      Note that the original methods on the object are not overwritten but new methods are created with the Async-postfix. For example, if you promisifyAll() the node.js fs object use fs.statAsync() to call the promisified stat method.

                                                    method props

                                                    static props: {
                                                    <K, V>(map: Resolvable<Map<K, Resolvable<V>>>): Bluebird<Map<K, V>>;
                                                    <T>(object: PromiseLike<Bluebird.ResolvableProps<T>>): Bluebird<T>;
                                                    <T>(object: Bluebird.ResolvableProps<T>): Bluebird<T>;
                                                    };
                                                    • Same as calling Promise.props(thisPromise). With the exception that if this promise is bound to a value, the returned promise is bound to that value too.

                                                    • Like ``Promise.all`` but for object properties instead of array items. Returns a promise that is fulfilled when all the properties of the object are fulfilled.

                                                      The promise's fulfillment value is an object with fulfillment values at respective keys to the original object. If any promise in the object rejects, the returned promise is rejected with the rejection reason.

                                                      If object is a trusted Promise, then it will be treated as a promise for object rather than for its properties. All other objects are treated for their properties as is returned by Object.keys - the object's own enumerable properties.

                                                      *The original object is not modified.*

                                                    method race

                                                    static race: <R>(values: Resolvable<Iterable<Resolvable<R>>>) => Bluebird<R>;
                                                    • Same as calling Promise.race(thisPromise, count). With the exception that if this promise is bound to a value, the returned promise is bound to that value too.

                                                    • Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled or rejected as soon as a promise in the array is fulfilled or rejected with the respective rejection reason or fulfillment value.

                                                      **Note** If you pass empty array or a sparse array with no values, or a promise/thenable for such, it will be forever pending.

                                                    method reason

                                                    reason: () => any;
                                                    • Get the rejection reason for the underlying promise. Throws if the promise isn't rejected yet.

                                                      throws TypeError

                                                    method reduce

                                                    static reduce: <R, U>(
                                                    values: Resolvable<Iterable<Resolvable<R>>>,
                                                    reducer: (
                                                    total: U,
                                                    current: R,
                                                    index: number,
                                                    arrayLength: number
                                                    ) => Resolvable<U>,
                                                    initialValue?: Resolvable<U>
                                                    ) => Bluebird<U>;
                                                    • Same as calling Promise.reduce(thisPromise, Function reducer, initialValue). With the exception that if this promise is bound to a value, the returned promise is bound to that value too.

                                                    • Reduce an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given reducer function with the signature (total, current, index, arrayLength) where item is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well.

                                                      If the reducer function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration.

                                                      *The original array is not modified. If no initialValue is given and the array doesn't contain at least 2 items, the callback will not be called and undefined is returned.

                                                      If initialValue is given and the array doesn't have at least 1 item, initialValue is returned.*

                                                    method reflect

                                                    reflect: () => Bluebird<Bluebird.Inspection<R>>;
                                                    • Synchronously inspect the state of this promise. The PromiseInspection will represent the state of the promise as snapshotted at the time of calling .reflect().

                                                    method reject

                                                    static reject: (reason: any) => Bluebird<never>;
                                                    • Create a promise that is rejected with the given reason.

                                                    method resolve

                                                    static resolve: { (): Bluebird<void>; <R>(value: Resolvable<R>): Bluebird<R> };
                                                    • Create a promise that is resolved with the given value. If value is a thenable or promise, the returned promise will assume its state.

                                                    method return

                                                    return: { (): Bluebird<void>; <U>(value: U): Bluebird<U> };
                                                    • Convenience method for:

                                                      .then(function() { return value; });

                                                      in the case where value doesn't change its value. That means value is bound at the time of calling .return()

                                                      Alias .thenReturn(); for compatibility with earlier ECMAScript version.

                                                    method some

                                                    static some: <R>(
                                                    values: Resolvable<Iterable<Resolvable<R>>>,
                                                    count: number
                                                    ) => Bluebird<R[]>;
                                                    • Same as calling Promise.some(thisPromise). With the exception that if this promise is bound to a value, the returned promise is bound to that value too. Same as calling Promise.some(thisPromise). With the exception that if this promise is bound to a value, the returned promise is bound to that value too.

                                                    • Initiate a competitive race between multiple promises or values (values will become immediately fulfilled promises). When count amount of promises have been fulfilled, the returned promise is fulfilled with an array that contains the fulfillment values of the winners in order of resolution.

                                                      If too many promises are rejected so that the promise can never become fulfilled, it will be immediately rejected with an array of rejection reasons in the order they were thrown in.

                                                      *The original array is not modified.*

                                                    method spread

                                                    spread: <U, Q>(
                                                    this: Bluebird<R & Iterable<Q>>,
                                                    fulfilledHandler: (...values: Q[]) => Resolvable<U>
                                                    ) => Bluebird<U>;
                                                    • Like calling .then, but the fulfillment value or rejection reason is assumed to be an array, which is flattened to the formal parameters of the handlers.

                                                    method suppressUnhandledRejections

                                                    suppressUnhandledRejections: () => void;
                                                    • Basically sugar for doing: somePromise.catch(function(){});

                                                      Which is needed in case error handlers are attached asynchronously to the promise later, which would otherwise result in premature unhandled rejection reporting.

                                                    method tap

                                                    tap: (onFulFill: (value: R) => Resolvable<any>) => Bluebird<R>;
                                                    • Like .finally(), but not called for rejections.

                                                    method tapCatch

                                                    tapCatch: {
                                                    (onReject: (error?: any) => Resolvable<any>): Bluebird<R>;
                                                    <E1, E2, E3, E4, E5>(
                                                    filter1: Constructor<E1>,
                                                    filter2: Constructor<E2>,
                                                    filter3: Constructor<E3>,
                                                    filter4: Constructor<E4>,
                                                    filter5: Constructor<E5>,
                                                    onReject: (error: E1 | E2 | E3 | E4 | E5) => any
                                                    ): Bluebird<R>;
                                                    <E1, E2, E3, E4, E5>(
                                                    filter1: Constructor<E1> | CatchFilter<E1>,
                                                    filter2: Constructor<E2> | CatchFilter<E2>,
                                                    filter3: Constructor<E3> | CatchFilter<E3>,
                                                    filter4: Constructor<E4> | CatchFilter<E4>,
                                                    filter5: Constructor<E5> | CatchFilter<E5>,
                                                    onReject: (error: E1 | E2 | E3 | E4 | E5) => any
                                                    ): Bluebird<R>;
                                                    <E1, E2, E3, E4>(
                                                    filter1: Constructor<E1>,
                                                    filter2: Constructor<E2>,
                                                    filter3: Constructor<E3>,
                                                    filter4: Constructor<E4>,
                                                    onReject: (error: E1 | E2 | E3 | E4) => any
                                                    ): Bluebird<R>;
                                                    <E1, E2, E3, E4>(
                                                    filter1: Constructor<E1> | CatchFilter<E1>,
                                                    filter2: Constructor<E2> | CatchFilter<E2>,
                                                    filter3: Constructor<E3> | CatchFilter<E3>,
                                                    filter4: Constructor<E4> | CatchFilter<E4>,
                                                    onReject: (error: E1 | E2 | E3 | E4) => any
                                                    ): Bluebird<R>;
                                                    <E1, E2, E3>(
                                                    filter1: Constructor<E1>,
                                                    filter2: Constructor<E2>,
                                                    filter3: Constructor<E3>,
                                                    onReject: (error: E1 | E2 | E3) => any
                                                    ): Bluebird<R>;
                                                    <E1, E2, E3>(
                                                    filter1: Constructor<E1> | CatchFilter<E1>,
                                                    filter2: Constructor<E2> | CatchFilter<E2>,
                                                    filter3: Constructor<E3> | CatchFilter<E3>,
                                                    onReject: (error: E1 | E2 | E3) => any
                                                    ): Bluebird<R>;
                                                    <E1, E2>(
                                                    filter1: Constructor<E1>,
                                                    filter2: Constructor<E2>,
                                                    onReject: (error: E1 | E2) => any
                                                    ): Bluebird<R>;
                                                    <E1, E2>(
                                                    filter1: Constructor<E1> | CatchFilter<E1>,
                                                    filter2: Constructor<E2> | CatchFilter<E2>,
                                                    onReject: (error: E1 | E2) => any
                                                    ): Bluebird<R>;
                                                    <E1>(filter1: Constructor<E1>, onReject: (error: E1) => any): Bluebird<R>;
                                                    <E1>(
                                                    filter1: Constructor<E1> | CatchFilter<E1>,
                                                    onReject: (error: E1) => any
                                                    ): Bluebird<R>;
                                                    };
                                                    • Like .catch() but rethrows the error

                                                    method then

                                                    then: {
                                                    <U>(
                                                    onFulfill?: (value: R) => Resolvable<U>,
                                                    onReject?: (error: any) => Resolvable<U>
                                                    ): Bluebird<U>;
                                                    <TResult1 = R, TResult2 = never>(
                                                    onfulfilled?: (value: R) => Resolvable<TResult1>,
                                                    onrejected?: (reason: any) => Resolvable<TResult2>
                                                    ): Bluebird<TResult1 | TResult2>;
                                                    };
                                                    • Promises/A+ .then(). Returns a new promise chained from this promise.

                                                      The new promise will be rejected or resolved depending on the passed fulfilledHandler, rejectedHandler and the state of this promise.

                                                    method thenReturn

                                                    thenReturn: { (): Bluebird<void>; <U>(value: U): Bluebird<U> };

                                                      method thenThrow

                                                      thenThrow: (reason: Error) => Bluebird<never>;

                                                        method throw

                                                        throw: (reason: Error) => Bluebird<never>;
                                                        • Convenience method for:

                                                          .then(function() { throw reason; }); Same limitations apply as with .return().

                                                          Alias .thenThrow(); for compatibility with earlier ECMAScript version.

                                                        method timeout

                                                        timeout: (ms: number, message?: string | Error) => Bluebird<R>;
                                                        • Returns a promise that will be fulfilled with this promise's fulfillment value or rejection reason. However, if this promise is not fulfilled or rejected within ms milliseconds, the returned promise is rejected with a TimeoutError or the error as the reason.

                                                          You may specify a custom error message with the message parameter.

                                                        method toJSON

                                                        toJSON: () => object;
                                                        • This is implicitly called by JSON.stringify when serializing the object. Returns a serialized representation of the Promise.

                                                        method toString

                                                        toString: () => string;
                                                        • Convert to String.

                                                        method try

                                                        static try: <R>(fn: () => Resolvable<R>) => Bluebird<R>;
                                                        • Start the chain of promises with Promise.try. Any synchronous exceptions will be turned into rejections on the returned promise.

                                                          Note about second argument: if it's specifically a true array, its values become respective arguments for the function call. Otherwise it is passed as is as the first argument for the function call.

                                                          Alias for attempt(); for compatibility with earlier ECMAScript version.

                                                        method using

                                                        static using: {
                                                        <R, T>(
                                                        disposer: Bluebird.Disposer<R>,
                                                        executor: (transaction: R) => PromiseLike<T>
                                                        ): Bluebird<T>;
                                                        <R1, R2, T>(
                                                        disposer: Bluebird.Disposer<R1>,
                                                        disposer2: Bluebird.Disposer<R2>,
                                                        executor: (transaction1: R1, transaction2: R2) => PromiseLike<T>
                                                        ): Bluebird<T>;
                                                        <R1, R2, R3, T>(
                                                        disposer: Bluebird.Disposer<R1>,
                                                        disposer2: Bluebird.Disposer<R2>,
                                                        disposer3: Bluebird.Disposer<R3>,
                                                        executor: (
                                                        transaction1: R1,
                                                        transaction2: R2,
                                                        transaction3: R3
                                                        ) => PromiseLike<T>
                                                        ): Bluebird<T>;
                                                        };
                                                        • In conjunction with .disposer, using will make sure that no matter what, the specified disposer will be called when the promise returned by the callback passed to using has settled. The disposer is necessary because there is no standard interface in node for disposing resources.

                                                        method value

                                                        value: () => R;
                                                        • Get the fulfillment value of the underlying promise. Throws if the promise isn't fulfilled yet.

                                                          throws TypeError

                                                        class CancellationError

                                                        class CancellationError extends Error {}
                                                        • Signals that an operation has been aborted or cancelled. The default reason used by .cancel.

                                                        class Disposer

                                                        class Disposer<R> {}
                                                        • returned by Bluebird.disposer().

                                                        class OperationalError

                                                        class OperationalError extends Error {}
                                                        • Represents an error is an explicit promise rejection as opposed to a thrown error. For example, if an error is errbacked by a callback API promisified through undefined or undefined and is not a typed error, it will be converted to a OperationalError which has the original error in the .cause property.

                                                          OperationalErrors are caught in .error handlers.

                                                        class TimeoutError

                                                        class TimeoutError extends Error {}
                                                        • Signals that an operation has timed out. Used as a custom cancellation reason in .timeout.

                                                        Interfaces

                                                        interface ConcurrencyOption

                                                        interface ConcurrencyOption {}

                                                          property concurrency

                                                          concurrency: number;

                                                            interface CoroutineOptions

                                                            interface CoroutineOptions {}

                                                              method yieldHandler

                                                              yieldHandler: (value: any) => any;

                                                                interface FromNodeOptions

                                                                interface FromNodeOptions {}

                                                                  property multiArgs

                                                                  multiArgs?: boolean | undefined;

                                                                    interface Inspection

                                                                    interface Inspection<R> {}

                                                                      method isCancelled

                                                                      isCancelled: () => boolean;
                                                                      • See if the underlying promise was cancelled at the creation time of this inspection object.

                                                                      method isFulfilled

                                                                      isFulfilled: () => boolean;
                                                                      • See if the underlying promise was fulfilled at the creation time of this inspection object.

                                                                      method isPending

                                                                      isPending: () => boolean;
                                                                      • See if the underlying promise was defer at the creation time of this inspection object.

                                                                      method isRejected

                                                                      isRejected: () => boolean;
                                                                      • See if the underlying promise was rejected at the creation time of this inspection object.

                                                                      method reason

                                                                      reason: () => any;
                                                                      • Get the rejection reason for the underlying promise. Throws if the promise wasn't rejected at the creation time of this inspection object.

                                                                        throws TypeError

                                                                      method value

                                                                      value: () => R;
                                                                      • Get the fulfillment value of the underlying promise. Throws if the promise wasn't fulfilled at the creation time of this inspection object.

                                                                        throws TypeError

                                                                      interface PromisifyAllOptions

                                                                      interface PromisifyAllOptions<T> extends PromisifyOptions {}

                                                                        property suffix

                                                                        suffix?: string | undefined;

                                                                          method filter

                                                                          filter: (
                                                                          name: string,
                                                                          func: (...args: any[]) => any,
                                                                          target?: any,
                                                                          passesDefaultFilter?: boolean
                                                                          ) => boolean;

                                                                            method promisifier

                                                                            promisifier: (
                                                                            this: T,
                                                                            originalMethod: (...args: any[]) => any,
                                                                            defaultPromisifer: (...args: any[]) => (...args: any[]) => Bluebird<any>
                                                                            ) => () => PromiseLike<any>;

                                                                              interface PromisifyOptions

                                                                              interface PromisifyOptions {}

                                                                                property context

                                                                                context?: any;

                                                                                  property multiArgs

                                                                                  multiArgs?: boolean | undefined;

                                                                                    interface Resolver

                                                                                    interface Resolver<R> {}

                                                                                      property promise

                                                                                      promise: Bluebird<R>;
                                                                                      • Returns a reference to the controlled promise that can be passed to clients.

                                                                                      method callback

                                                                                      callback: (err: any, value: R, ...values: R[]) => void;
                                                                                      • Gives you a callback representation of the PromiseResolver. Note that this is not a method but a property. The callback accepts error object in first argument and success values on the 2nd parameter and the rest, I.E. node js conventions.

                                                                                        If the the callback is called with multiple success values, the resolver fulfills its promise with an array of the values.

                                                                                      method reject

                                                                                      reject: (reason: any) => void;
                                                                                      • Reject the underlying promise with reason as the rejection reason.

                                                                                      method resolve

                                                                                      resolve: { (value: R): void; (): void };
                                                                                      • Resolve the underlying promise with value as the resolution value. If value is a thenable or a promise, the underlying promise will assume its state.

                                                                                      interface SpreadOption

                                                                                      interface SpreadOption {}

                                                                                        property spread

                                                                                        spread: boolean;

                                                                                          Type Aliases

                                                                                          type ResolvableProps

                                                                                          type ResolvableProps<T> = object & { [K in keyof T]: Resolvable<T[K]> };

                                                                                            type Thenable

                                                                                            type Thenable<T> = PromiseLike<T>;
                                                                                            • Deprecated

                                                                                              Use PromiseLike directly.

                                                                                            Package Files (1)

                                                                                            Dependencies (0)

                                                                                            No dependencies.

                                                                                            Dev Dependencies (0)

                                                                                            No dev dependencies.

                                                                                            Peer Dependencies (0)

                                                                                            No peer dependencies.

                                                                                            Badge

                                                                                            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/bluebird.

                                                                                            • Markdown
                                                                                              [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/bluebird)
                                                                                            • HTML
                                                                                              <a href="https://www.jsdocs.io/package/@types/bluebird"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>