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

window.requestIdleCallback type missing #40807

Closed
nstepien opened this issue Sep 28, 2020 · 4 comments
Closed

window.requestIdleCallback type missing #40807

nstepien opened this issue Sep 28, 2020 · 4 comments
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this
Milestone

Comments

@nstepien
Copy link

TypeScript Version: 4.1.0-dev.20200925

Search Terms: requestIdleCallback

Code

requestIdleCallback(() => {})

Expected behavior:
requestIdleCallback is typed.

Actual behavior:

Cannot find name 'requestIdleCallback'. ts(2304)

Playground Link:
https://www.typescriptlang.org/play?#code/E4UwjgriDOAuCSATANiAwgQ2cgRhgxgNYAUxAlAAQC8AfBQN4C+ZQA

Related Issues:
#21309
The previous issue was labelled as "working as intended" over 2 years ago, but I don't think the API is experimental anymore. It is available in Chrome/Firefox/Edgium, and Safari (behind a flag).
https://www.w3.org/TR/requestidlecallback/
https://w3c.github.io/requestidlecallback/
https://caniuse.com/requestidlecallback
https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback

@utsav0209
Copy link

Do we want the support for this?

As I read from MDN safari still does not support the requestIdleCallback.

If we want to have support, I can make a PR.

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this labels Sep 29, 2020
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Sep 29, 2020
@RyanCavanaugh
Copy link
Member

I want to discuss our experimental API coverage in lib.d.ts before committing to accepting a PR, but certainly it should eventually be in there

@thw0rted
Copy link

Ryan, on the previous issue you said that TS doesn't support experimental APIs. The MDN page for requestIdleCallback is marked as experimental but so is fetch -- the biggest difference I can see is that requestIdleCallback comes from a "Proposed Recommendation", rather than a "Living Standard". Is the status of the spec the issue here?

(It strikes me as strange that requestIdleCallback doesn't appear to have gone anywhere in over 3 years, but is supported in all modern browsers except Safari. I guess the old draft didn't have any major problems so they've left it alone?)

@nstepien
Copy link
Author

microsoft/TypeScript-DOM-lib-generator#1029
It's in TS 4.4! Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this
Projects
None yet
Development

No branches or pull requests

4 participants