Skip to content

add promise.any - #33844

Merged
Nathan Shively-Sanders (sandersn) merged 6 commits into
microsoft:masterfrom
Kingwl:promise-prototype-any
Mar 11, 2020
Merged

Nathan Shively-Sanders (sandersn) merged 6 commits into
microsoft:masterfrom
Kingwl:promise-prototype-any

Conversation

@Kingwl

@Kingwl Wenlu Wang (Kingwl) commented Oct 7, 2019 •

Copy link
Copy Markdown
Contributor

Fixes #33843

BTW: #31085

@Kingwl Wenlu Wang (Kingwl) changed the title add promise.prototype.any add promise.any Oct 28, 2019
Comment thread src/lib/esnext.promise.d.ts Outdated
@sandersn Nathan Shively-Sanders (sandersn) added the For Milestone Bug PRs that fix a bug with a specific milestone label Feb 1, 2020

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wenlu Wang (@Kingwl) This looks good; I'll merge it as soon as you update the jsdoc. (I'm not sure my suggestion is the best -- it might be possible to condense the wording overall.)

Comment thread src/lib/esnext.promise.d.ts Outdated
@sandersn

Copy link
Copy Markdown
Member

A baseline needed to be updated after the merge from master. I'll merge this after CI finishes running.

@sandersn
Nathan Shively-Sanders (sandersn) merged commit 20625a9 into microsoft:master Mar 11, 2020
@mt-yannick

Chiasson Yannick (mt-yannick) commented Jun 8, 2020 •

Copy link
Copy Markdown

Hi, I am able to compile successfully but at runtime, I receive a Promise.any is undefined error. I am using typescript 3.9.5 in my project. This is my tsconfig:

{
  "compilerOptions": {
    "target": "ES6",
    "module": "commonjs",
    "strict": true,
    "esModuleInterop": true,
    "outDir": "dist",
    "lib": [
      "dom",
      "esnext",
      "esnext.promise"
    ],
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "forceConsistentCasingInFileNames": true,
    "inlineSourceMap": true,
  }
}

Any feedback would be much appreciated.

@alt1o

Copy link
Copy Markdown

Hi, I am able to compile successfully but at runtime, I receive a Promise.any is undefined error. I am using typescript 3.9.5 in my project. This is my tsconfig:

{
  "compilerOptions": {
    "target": "ES6",
    "module": "commonjs",
    "strict": true,
    "esModuleInterop": true,
    "outDir": "dist",
    "lib": [
      "dom",
      "esnext",
      "esnext.promise"
    ],
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "forceConsistentCasingInFileNames": true,
    "inlineSourceMap": true,
  }
}

Any feedback would be much appreciated.

same with me. typescript 3.9.7

@sandersn

Copy link
Copy Markdown
Member

Chiasson Yannick (@mt-yannick) @alongite what VM are you using? I looked at https://caniuse.com/#search=Promise.any and it's only on recent versions of Chrome and Firefox as far as I can tell. It's not in Node 14 yet.

@mt-yannick

Copy link
Copy Markdown

Nathan Shively-Sanders (@sandersn) Oh! Thank you for clarifying!! So if I understand correctly, this PR implements the types for Promise.any, and specifying "esnext.promise" in compilerOptions.libs will make the compiler aware that Promise.any exists, but we are still responsible for assuring that an implementation exists!

@sandersn

Copy link
Copy Markdown
Member

Chiasson Yannick (@mt-yannick) yes, that's exactly right. Stuff in "esnext" is going to be very new, so you may need to provide your own polyfill.

@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Milestone Bug PRs that fix a bug with a specific milestone

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

proposal-promise-any

5 participants