Repository navigation
Make requestidlecallback work with TS 4.4 DOM - #54081
Conversation
TS 4.4 improves its types for requestidlecallback. This PR makes DT match those upcoming types. Needed after microsoft/TypeScript#44684 is merged.
|
@sandersn Thank you for submitting this PR! This is a live comment which I will keep updated. 1 package in this PRCode ReviewsThis PR can be merged once it's reviewed by a DT maintainer. You can test the changes of this PR in the Playground. Status
Once every item on this list is checked, I'll ask you for permission to merge and publish the changes. Diagnostic Information: What the bot saw about this PR{
"type": "info",
"now": "-",
"pr_number": 54081,
"author": "sandersn",
"headCommitOid": "d6144ce5a57eb025163617c6fc5da9d78e1d954a",
"lastPushDate": "2021-06-28T19:03:09.000Z",
"lastActivityDate": "2021-06-28T19:03:09.000Z",
"hasMergeConflict": false,
"isFirstContribution": false,
"tooManyFiles": false,
"popularityLevel": "Well-liked by everyone",
"pkgInfo": [
{
"name": "requestidlecallback",
"kind": "edit",
"files": [
{
"path": "types/requestidlecallback/index.d.ts",
"kind": "definition"
}
],
"owners": [
"hax",
"VladimirGrenaderov",
"maxbogus",
"teramotodaiki"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Well-liked by everyone"
}
],
"reviews": [],
"mainBotCommentID": 868670474,
"ciResult": "pass"
} |
|
🔔 @hax @VladimirGrenaderov @maxbogus @teramotodaiki — please review this PR in the next few days. Be sure to explicitly select |
|
@sandersn The CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! Note: builds which are failing do not end up on the list of PRs for the DT maintainers to review. |
|
@sandersn The CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! Note: builds which are failing do not end up on the list of PRs for the DT maintainers to review. |
|
I just published |
|
|
||
| type IdleCallbackHandle = number; | ||
|
|
||
| type IdleRequestCallback = (deadline: IdleDeadline) => void; |
There was a problem hiding this comment.
What are you doing?
There was a problem hiding this comment.
I am pretty sure in TypeScript 4.4 IdleRequestCallback is not added, not even mentioning TypeScript 4.4 hasn't been released yet.
There was a problem hiding this comment.
It is added here: https://github.com/microsoft/TypeScript/pull/44684/files#diff-dc0eab937d15e62545da3ed7b4f40ad6b24f15dd88fbc6ceda2bfb4ed8356eb0R17905
4.4's beta ships this week, but packages on Definitely Typed have to compile with the nightly version of Typescript. requestidlecallback polyfills types from the DOM, so it has to match them exactly. Unfortunately, type aliases can only be defined once, so requestidlecallback can't declare IdleRequestCallback. However, older Typescripts could at continue using request and requestIdleCallback and others if it were inlined here.
I did that in #54166
There was a problem hiding this comment.
4.4's beta ships this week, but packages on Definitely Typed have to compile with the nightly version of Typescript. requestidlecallback polyfills types from the DOM, so it has to match them exactly. Unfortunately, type aliases can only be defined once, so requestidlecallback can't declare IdleRequestCallback. However, older Typescripts could at continue using
requestandrequestIdleCallbackand others if it were inlined here.
Then it should be published in a major version instead of a minor version. Don't you know you are breaking all prior TS 4.4 users?
TS 4.4 improves its types for requestidlecallback. This PR makes DT match those upcoming types.
Needed after microsoft/TypeScript#44684 is merged.