/** * Constructs a promise for an immediate reference, passes promises through, or * coerces promises from different systems. * @param value immediate reference or promise */ declare function _exports(value: any): any; declare namespace _exports { export { Q as resolve }; export { nextTick }; export const longStackSupport: boolean; export { defer }; export { promise as Promise }; export { promise }; export function passByCopy(object: any): any; /** * If two promises eventually fulfill to the same value, promises that value, * but otherwise rejects. * @param x {Any*} * @param y {Any*} * @returns {Any*} a promise for x and y if they are the same, but a rejection * otherwise. * */ export function join(x: Any, y: Any): Any; export { race }; export { Promise as makePromise }; export function tap(promise: any, callback: any): any; export { when }; export function thenResolve(promise: any, value: any): any; export function thenReject(promise: any, reason: any): any; export { nearer }; export { isPromise }; export { isPromiseAlike }; export { isPending }; export { isFulfilled }; export { isRejected }; export { resetUnhandledRejections }; export function getUnhandledReasons(): any[]; export function stopUnhandledRejectionTracking(): void; export { reject }; export { fulfill }; export { master }; export { spread }; export { async }; export { spawn }; export { _return as return }; export { promised }; export { dispatch }; /** * Gets the value of a property in a future turn. * @param object promise or immediate reference for target object * @param name name of property to get * @return promise for the property value */ export function get(object: any, key: any): any; /** * Sets the value of a property in a future turn. * @param object promise or immediate reference for object object * @param name name of property to set * @param value new value of property * @return promise for the return value */ export function set(object: any, key: any, value: any): any; export function del(object: any, key: any): any; function _delete(object: any, key: any): any; export { _delete as delete }; export function mapply(object: any, name: any, args: any): any; export function post(object: any, name: any, args: any): any; export function send(object: any, name: any, ...args: any[]): any; export function mcall(object: any, name: any, ...args: any[]): any; export function invoke(object: any, name: any, ...args: any[]): any; /** * Applies the promised function in a future turn. * @param object promise or immediate reference for target function * @param args array of application arguments */ export function fapply(object: any, args: any): any; export function _try(object: any, ...args: any[]): any; export { _try as try }; export function fcall(object: any, ...args: any[]): any; /** * Binds the promised function, transforming return values into a fulfilled * promise and thrown errors into a rejected one. * @param object promise or immediate reference for target function * @param ...args array of application arguments */ export function fbind(object: any, ...args: any[]): (...args: any[]) => any; /** * Requests the names of the owned properties of a promised * object in a future turn. * @param object promise or immediate reference for target object * @return promise for the keys of the eventually settled object */ export function keys(object: any): any; export { all }; export { any }; export function allResolved(...args: any[]): any; export { allSettled }; export function fail(object: any, rejected: any): any; function _catch(object: any, rejected: any): any; export { _catch as catch }; export { progress }; export function fin(object: any, callback: Function): any; function _finally(object: any, callback: Function): any; export { _finally as finally }; /** * Terminates a chain of promises, forcing rejections to be * thrown as exceptions. * @param {Any*} promise at the end of a chain of promises * @returns nothing */ export function done(object: any, fulfilled: any, rejected: any, progress: any): any; /** * Causes a promise to be rejected if it does not get fulfilled before * some milliseconds time out. * @param {Any*} promise * @param {Number} milliseconds timeout * @param {Any*} custom error message or Error object (optional) * @returns a promise for the resolution of the given promise if it is * fulfilled before the timeout, otherwise rejected. */ export function timeout(object: any, ms: any, error: any): any; /** * Returns a promise for the given value (or promised value), some * milliseconds after it resolved. Passes rejections immediately. * @param {Any*} promise * @param {Number} milliseconds * @returns a promise for the resolution of the given promise after milliseconds * time has elapsed since the resolution of the given promise. * If the given promise rejects, that is passed immediately. */ export function delay(object: any, timeout: any): any; /** * Passes a continuation to a Node function, which is called with the given * arguments provided as an array, and returns a promise. * * Q.nfapply(FS.readFile, [__filename]) * .then(function (content) { * }) * */ export function nfapply(callback: any, args: any): any; /** * Passes a continuation to a Node function, which is called with the given * arguments provided individually, and returns a promise. * @example * Q.nfcall(FS.readFile, __filename) * .then(function (content) { * }) * */ export function nfcall(callback: any, ...args: any[]): any; export function nfbind(callback: any, ...args: any[]): (...args: any[]) => any; export function denodeify(callback: any, ...args: any[]): (...args: any[]) => any; export function nbind(callback: any, thisp: any, ...args: any[]): (...args: any[]) => any; export function nmapply(object: any, name: string, args: any[]): any; export function npost(object: any, name: string, args: any[]): any; export function nsend(object: any, name: string, ...args: any[]): any; export function nmcall(object: any, name: string, ...args: any[]): any; export function ninvoke(object: any, name: string, ...args: any[]): any; export { nodeify }; export function noConflict(): never; } export = _exports; declare var nextTick: any; declare function defer(): any; declare class defer { /** * Creates a Node-style callback that will resolve or reject the deferred * promise. * @returns a nodeback */ makeNodeResolver(): (error: any, value: any, ...args: any[]) => void; } declare function promise(resolver: any): any; declare namespace promise { export { race }; export { all }; export { reject }; export { Q as resolve }; } declare function race(answerPs: any): any; declare function when(value: any, fulfilled: any, rejected: any, progressed: any): any; declare function nearer(value: any): any; declare function isPromise(object: any): boolean; declare function isPromiseAlike(object: any): boolean; declare function isPending(object: any): boolean; declare function isFulfilled(object: any): boolean; declare function isRejected(object: any): boolean; declare function resetUnhandledRejections(): void; declare function reject(reason: any): any; declare function fulfill(value: any): any; declare function master(object: any): any; declare function spread(value: any, fulfilled: any, rejected: any): any; declare function async(makeGenerator: any): (...args: any[]) => any; declare function spawn(makeGenerator: any): void; declare function _return(value: any): void; declare function promised(callback: any): (...args: any[]) => any; declare function dispatch(object: any, op: any, args: any): any; declare function all(promises: any): any; declare function any(promises: any): any; declare function allSettled(promises: any): any; declare function progress(object: any, progressed: any): any; declare function nodeify(object: any, nodeback: any): any;