Skip to content

Releases: then/is-promise

4.0.0

27 Apr 15:34
5a240f6
Compare
Choose a tag to compare

Breaking Changes

  • Use PromiseLike instead of Promise in TypeScript (#40)

    This is only a breaking change for TypeScript users.

    In the following code:

    function foo(x: PromiseLike<string> | string) {
      if (isPromise(x)) {
        return x;
      } else {
        return Promise.resolve(x);
      }
    }

    TypeScript would previously have incorrectly inferred foo as returning Promisestring>when in fact it returnsPromiseLikestring>. The latest version fixes this. If you instead had the following code, it should work exactly the same as before:

    function foo(x: Promise<string> | string) {
      if (isPromise(x)) {
        return x;
      } else {
        return Promise.resolve(x);
      }
    }

    This update is to reflect the fact that is-promise does "duck" typing, rather than an instanceof check.

3.0.0

26 Apr 13:39
1fc71a4
Compare
Choose a tag to compare

Breaking Changes

  • Restricted "exports" in package.json (for node 14+) (#30)

    The only ways to import this are now:

    import isPromise from 'is-promise';

    or

    const isPromise = require('is-promise');

    If you were requiring things like the package.json file within the package, these are not part of the public API, and will no longer be accessible.

  • is-promise now uses "default" exports in ES Modules environments (#30)

    If you were using ES6 style imports via

    import * as isPromise from 'is-promise';

    you will need to update this to

    import isPromise from 'is-promise';

    If you were using CommonJS style require, no change is needed.

  • This package now comes bundled with TypeScript definitions (#31)

    This means you may get new errors that you didn't see before if you are using TypeScript. If you are not using TypeScript, this change will not impact you.

2.2.2

25 Apr 18:19
Compare
Choose a tag to compare

Removed ESM support that was added in 2.2.0 as it turns out to be a breaking change (see #20)

2.2.1

25 Apr 18:19
Compare
Choose a tag to compare

Attempted to fix ESM, but this is still broken for people who import the package.json file.

2.2.0

25 Apr 15:04
Compare
Choose a tag to compare
  • Adds TypeScript definition
  • Adds support for ES Module style default import

This version of is-promse is broken. Please use 2.2.2