@types/tspromise
TypeScript icon, indicating that this package has built-in type declarations

0.0.32 • Public • Published

Installation

npm install --save @types/tspromise

Summary

This package contains type definitions for tspromise (https://github.com/soywiz/tspromise).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tspromise.

index.d.ts

/// <reference types="node" />
declare class Thenable<T> {
    then<TR>(onFulfilled: (value: T) => Thenable<TR>, onRejected?: (error: Error) => TR): Thenable<TR>;
    then<TR>(onFulfilled: (value: T) => Thenable<TR>, onRejected?: (error: Error) => void): Thenable<TR>;
    then<TR>(onFulfilled: (value: T) => TR, onRejected?: (error: Error) => void): Thenable<TR>;
    then<TR>(onFulfilled: (value: T) => TR, onRejected?: (error: Error) => TR): Thenable<TR>;
    catch(onRejected: (error: Error) => void): Thenable<T>;
}

interface NodeCallback<T> {
    (err: Error, value: T): void;
}

declare module "tspromise" {
    class Promise<T> extends Thenable<T> {
        constructor(callback: (resolve: (value?: T) => void, reject?: (error: Error) => void) => void);
        static resolve<T>(value?: T): Thenable<T>;
        static resolve<T>(promise: Thenable<T>): Thenable<T>;
        static reject<T>(error: Error): Thenable<T>;
        static all(promises: Array<Thenable<any>>): Thenable<any[]>;
        static async<TR>(callback: () => TR): () => Thenable<TR>;
        static async<T1, TR>(callback: (p1: T1) => TR): (p1: T1) => Thenable<TR>;
        static async<T1, T2, TR>(callback: (p1: T1, p2: T2) => TR): (p1: T1, p2: T2) => Thenable<TR>;
        static async<T1, T2, T3, TR>(
            callback: (p1: T1, p2: T2, p3: T3) => TR,
        ): (p1: T1, p2: T2, p3: T3) => Thenable<TR>;
        static async<T1, T2, T3, T4, TR>(
            callback: (p1: T1, p2: T2, p3: T3, p4: T4) => TR,
        ): (p1: T1, p2: T2, p3: T3, p4: T4) => Thenable<TR>;
        static spawn<TR>(generatorFunction: () => TR): Thenable<TR>;
        static rewriteFolderSync(path: string): void;
        static waitAsync(time: number): Thenable<{}>;
        static nfcall<T>(obj: any, methodName: String, ...args: any[]): Thenable<T>;
    }

    export = Promise;
}

declare function yield<T>(promise: Thenable<T>): T;

Additional Details

  • Last updated: Mon, 20 Nov 2023 23:36:24 GMT
  • Dependencies: @types/node

Credits

These definitions were written by Carlos Ballesteros Velasco.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/tspromise

Weekly Downloads

1

Version

0.0.32

License

MIT

Unpacked Size

6.44 kB

Total Files

5

Last publish

Collaborators

  • types