// Type definitions for p-cancelable 0.3 // Project: https://github.com/sindresorhus/p-cancelable#readme // Definitions by: BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = PCancelable; declare const PCancelable: PCancelableConstructor; interface PCancelableConstructor extends PromiseConstructor { readonly prototype: PCancelable.PCancelable; readonly CancelError: PCancelable.CancelErrorConstructor; fn(wrapper: (onCancel: (fn?: () => void) => void, input: T) => PromiseLike): (input: T) => PCancelable.PCancelable; new(executor: (onCancel: (fn?: () => void) => void, resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): PCancelable.PCancelable; } declare namespace PCancelable { interface PCancelable extends Promise { readonly canceled: boolean; cancel(): void; } interface CancelErrorConstructor extends ErrorConstructor { new (): CancelError; } interface CancelError extends Error { readonly name: 'CancelError'; } }