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

6.0.4 • Public • Published

Installation

npm install --save @types/es6-promisify

Summary

This package contains type definitions for es6-promisify (https://github.com/digitaldesignlabs/es6-promisify#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/es6-promisify.

index.d.ts

// If the issue at https://github.com/Microsoft/TypeScript/issues/1360 is fixed,
// then an update should be submitted replacing the promisify declaration with
// the following declarations.
/*
function promisify<T>(original: (...args: any[], callback: (error: any, arg: T) => any) => any): ((...args: any[]) => Promise<T>);

function promisify(original: (...args: any[], callback: (error: any, ...args: any[]) => any) => any): ((...args: any[]) => Promise<any>);
*/

export type Callback<T> = (err: any, arg?: T) => any;
export type CallbackFunction = (...args: any[]) => any;
export type PromiseFunction = (...args: any[]) => Promise<any>;

export function promisify<T>(original: (cb: Callback<T>) => any): () => Promise<T>;
export function promisify<T, U>(original: (param1: U, cb: Callback<T>) => any): (param1: U) => Promise<T>;
export function promisify<T, U, V>(
    original: (param1: U, param2: V, cb: Callback<T>) => any,
): (param1: U, param2: V) => Promise<T>;
export function promisify<T, U, V, W>(
    original: (param1: U, param2: V, param3: W, cb: Callback<T>) => any,
): (param1: U, param2: V, param3: W) => Promise<T>;
export function promisify(original: CallbackFunction): PromiseFunction;

export namespace promisify {
    /**
     * This symbol can be placed on the function to be promisified to
     * provide names as an array of strings for the values in a success
     * callback.
     */
    const argumentNames: symbol;

    /**
     * The user can supply their own Promise implementation by setting it
     * here. Otherwise, the global Promise object will be used.
     */
    let Promise: PromiseConstructor;
}

Additional Details

  • Last updated: Mon, 06 Nov 2023 22:41:05 GMT
  • Dependencies: none

Credits

These definitions were written by Brian Schlenker.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/es6-promisify

Weekly Downloads

10,494

Version

6.0.4

License

MIT

Unpacked Size

5.87 kB

Total Files

5

Last publish

Collaborators

  • types