diff --git a/.travis.yml b/.travis.yml index e155464..f98fed0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,4 +3,3 @@ node_js: - '12' - '10' - '8' - - '6' diff --git a/index.d.ts b/index.d.ts index c4675e1..aa6608f 100644 --- a/index.d.ts +++ b/index.d.ts @@ -21,34 +21,25 @@ declare namespace pDefer { } } -declare const pDefer: { - /** - Create a deferred promise. +/** +Create a deferred promise. - @example - ``` - import pDefer = require('p-defer'); +@example +``` +import pDefer = require('p-defer'); - function delay(ms) { - const deferred = pDefer(); - setTimeout(deferred.resolve, ms, '🦄'); - return deferred.promise; - } +function delay(ms) { + const deferred = pDefer(); + setTimeout(deferred.resolve, ms, '🦄'); + return deferred.promise; +} - (async () => { - console.log(await delay(100)); - //=> '🦄' - })(); - ``` - */ - (): pDefer.DeferredPromise; - - // TODO: Remove this for the next major release, refactor the whole definition to: - // declare function pDefer(): pDefer.DeferredPromise< - // ValueType - // >; - // export = pDefer; - default: typeof pDefer; -}; +(async () => { + console.log(await delay(100)); + //=> '🦄' +})(); +``` +*/ +declare function pDefer(): pDefer.DeferredPromise; export = pDefer; diff --git a/index.js b/index.js index 552c70b..81ff2d2 100644 --- a/index.js +++ b/index.js @@ -12,5 +12,3 @@ const pDefer = () => { }; module.exports = pDefer; -// TODO: Remove this for the next major release -module.exports.default = pDefer; diff --git a/package.json b/package.json index b80b2bc..6d8b2ac 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "url": "sindresorhus.com" }, "engines": { - "node": ">=6" + "node": ">=8" }, "scripts": { "test": "xo && ava && tsd" @@ -29,12 +29,11 @@ "later", "async", "await", - "promises", - "bluebird" + "promises" ], "devDependencies": { "ava": "^2.0.0", - "tsd": "^0.7.2", + "tsd": "^0.7.3", "xo": "^0.24.0" } } diff --git a/readme.md b/readme.md index 1e6c7e9..3b4849e 100644 --- a/readme.md +++ b/readme.md @@ -36,15 +36,10 @@ function delay(ms) { ### pDefer() -Returns an `Object` with a `promise` property and functions to `resolve()` and `reject()`. +Returns an `object` with a `promise` property and functions to `resolve()` and `reject()`. ## Related - [p-lazy](https://github.com/sindresorhus/p-lazy) - Create a lazy promise that defers execution until `.then()` or `.catch()` is called - [More…](https://github.com/sindresorhus/promise-fun) - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com)