From e33019a16f7f2def69dab09dc0b0c0a96682c196 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 8 Jan 2018 09:42:40 +0100 Subject: [PATCH] Update promisify types (#58) --- src/promisify.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/promisify.js b/src/promisify.js index 5baa87314..2d8e9599b 100644 --- a/src/promisify.js +++ b/src/promisify.js @@ -3,7 +3,7 @@ /** @name promisify - @signature function promisify (this: ?Object, fn: Function, ...params: Array): Promise + @signature function promisify (this: ?Object, fn: Function, ...params: Array): Promise @summary Wraps an async callback into a `Promise` @description Wraps the supplied async function `fn` that has a standard JS callback `(error: Error, result: any)` into a `Promise`, passing the supplied parameters. When `error` is set, the Promise is rejected, else the Promise resolves with the `result` value. @@ -14,10 +14,11 @@ await promisify(null, (cb) => cb(new Error('error!'))); // rejects with `error!` */ // flowlint-next-line unclear-type:off -module.exports = function promisify (self: ?Object, fn: Function, ...params: Array): Promise { +module.exports = function promisify (self: ?Object, fn: Function, ...params: Array): Promise { return new Promise((resolve, reject) => { fn.apply(self, params.concat([ - (error: ?Error, result: mixed): void => { + // flowlint-next-line unclear-type:off + (error: ?Error, result: any): void => { if (error) { reject(error); } else {