Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add promise.any #53498

Merged
merged 2 commits into from
May 30, 2021
Merged

Add promise.any #53498

merged 2 commits into from
May 30, 2021

Conversation

AverageHelper
Copy link
Contributor

@AverageHelper AverageHelper commented May 29, 2021

Please fill in this template.

This works at runtime only if users import using import ... = require(...). There's a known bug with a dependency of promise.any that should be fixed in the next TypeScript version.

I don't know how that bug affects this PR. The typings are accurate to the best of my knowledge, and they work at runtime... users just can't use TypeScript's esModuleInterop with it.

Select one of these and delete the others:

If adding a new definition:

  • The package does not already provide its own types, or cannot have its .d.ts files generated via --declaration
  • If this is for an npm package, match the name. If not, do not conflict with the name of an npm package.
  • Create it with dts-gen --dt, not by basing it on an existing project.
  • Represents shape of module/library correctly
  • tslint.json should contain { "extends": "dtslint/dt.json" }, and no additional rules.
  • tsconfig.json should have noImplicitAny, noImplicitThis, strictNullChecks, and strictFunctionTypes set to true.

@AverageHelper AverageHelper marked this pull request as ready for review May 29, 2021 21:08
@typescript-bot typescript-bot added New Definition This PR creates a new definition package. Check Config Changes a module config files labels May 29, 2021
@typescript-bot
Copy link
Contributor

typescript-bot commented May 29, 2021

@AverageHelper Thank you for submitting this PR!

This is a live comment which I will keep updated.

1 package in this PR

Code Reviews

This PR adds a new definition, so it needs to be reviewed by a DT maintainer before it can be merged.

You can test the changes in this PR in the Playground.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ✅ Only a DT maintainer can approve changes when there are new packages added

All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 53498,
  "author": "AverageHelper",
  "headCommitOid": "9f479681a54248fbf462ed438ad0d9fc080813ab",
  "lastPushDate": "2021-05-29T16:48:51.000Z",
  "lastActivityDate": "2021-05-30T18:29:21.000Z",
  "mergeOfferDate": "2021-05-30T18:29:07.000Z",
  "mergeRequestDate": "2021-05-30T18:29:21.000Z",
  "mergeRequestUser": "AverageHelper",
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "tooManyFiles": false,
  "popularityLevel": "Well-liked by everyone",
  "pkgInfo": [
    {
      "name": "promise.any",
      "kind": "add",
      "files": [
        {
          "path": "types/promise.any/OTHER_FILES.txt",
          "kind": "package-meta",
          "suspect": "not [the expected form](https://github.com/DefinitelyTyped/DefinitelyTyped#user-content-other_filestxt)"
        },
        {
          "path": "types/promise.any/auto.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/promise.any/implementation.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/promise.any/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/promise.any/polyfill.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/promise.any/promise.any-tests.ts",
          "kind": "test"
        },
        {
          "path": "types/promise.any/requirePromise.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/promise.any/shim.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/promise.any/tsconfig.json",
          "kind": "package-meta",
          "suspect": "not [the expected form](https://github.com/DefinitelyTyped/DefinitelyTyped#user-content-tsconfigjson) (check: `compilerOptions.lib.1`)"
        },
        {
          "path": "types/promise.any/tslint.json",
          "kind": "package-meta-ok"
        }
      ],
      "owners": [],
      "addedOwners": [
        "AverageHelper"
      ],
      "deletedOwners": [],
      "popularityLevel": "Well-liked by everyone"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "peterblazejewicz",
      "date": "2021-05-30T18:28:27.000Z",
      "isMaintainer": true
    }
  ],
  "mainBotCommentID": 850899201,
  "ciResult": "pass"
}

@typescript-bot
Copy link
Contributor

🔔 @AverageHelper — you're the only owner, but it would still be good if you find someone to review this PR in the next few days, otherwise a maintainer will look at it. (And if you do find someone, maybe even recruit them to be a second owner to make future changes easier...)

@AverageHelper
Copy link
Contributor Author

AverageHelper commented May 29, 2021

Linking a comment on Promise.allSettled#5, which explains a bug with esModuleInterop in a dependency that promise.any shares.

The bug is one where something throws a TypeError: #<Object> is not a constructor error when calling a Promise.resolve shim. This only occurs when promise.any was imported using a default-import with esModuleInterop turned on, as in import any from "promise.any".

When import any = require("promise.any") is used instead, no such runtime errors occur. I've yet to track down the source of this issue, so I'm not yet sure where to file this bug, but I think it makes sense to report it here for now.

Copy link
Member

@peterblazejewicz peterblazejewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
@AverageHelper thx!

@typescript-bot typescript-bot added Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner labels May 30, 2021
@typescript-bot
Copy link
Contributor

@AverageHelper Everything looks good here. Great job! I am ready to merge this PR (at 9f47968) on your behalf.

If you'd like that to happen, please post a comment saying:

Ready to merge

and I'll merge this PR almost instantly. Thanks for helping out! ❤️

@AverageHelper
Copy link
Contributor Author

Ready to merge

@typescript-bot typescript-bot merged commit a71cbf5 into DefinitelyTyped:master May 30, 2021
@AverageHelper AverageHelper deleted the add-promise-any branch May 30, 2021 18:30
@typescript-bot
Copy link
Contributor

I just published @types/[email protected] to npm.

@ljharb ljharb mentioned this pull request Sep 23, 2023
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Check Config Changes a module config files Maintainer Approved New Definition This PR creates a new definition package. Self Merge This PR can now be self-merged by the PR author or an owner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants