Skip to content

Make requestidlecallback work with TS 4.4 DOM - #54081

Merged
sandersn merged 3 commits into
masterfrom
make-requestidlecallback-work-with-4.4-dom
Jun 28, 2021
Merged

sandersn merged 3 commits into
masterfrom
make-requestidlecallback-work-with-4.4-dom

Conversation

@sandersn

Copy link
Copy Markdown
Contributor

TS 4.4 improves its types for requestidlecallback. This PR makes DT match those upcoming types.

Needed after microsoft/TypeScript#44684 is merged.

TS 4.4 improves its types for requestidlecallback. This PR makes DT match those upcoming types.

Needed after microsoft/TypeScript#44684 is merged.
@typescript-bot

typescript-bot commented Jun 25, 2021 •

Copy link
Copy Markdown
Contributor

@sandersn 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 can be merged once it's reviewed by a DT maintainer.

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

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • 🕐 Only a DT maintainer can approve changes without tests

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"
}

@typescript-bot typescript-bot added the Untested Change This PR does not touch tests label Jun 25, 2021
@typescript-bot

Copy link
Copy Markdown
Contributor

🔔 @hax @VladimirGrenaderov @maxbogus @teramotodaiki — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

@typescript-bot typescript-bot added the The CI failed When GH Actions fails label Jun 25, 2021
@typescript-bot

Copy link
Copy Markdown
Contributor

@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 sandersn closed this Jun 28, 2021
@sandersn sandersn reopened this Jun 28, 2021
@typescript-bot typescript-bot added The CI failed When GH Actions fails and removed The CI failed When GH Actions fails labels Jun 28, 2021
@typescript-bot

Copy link
Copy Markdown
Contributor

@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.

@typescript-bot typescript-bot removed the The CI failed When GH Actions fails label Jun 28, 2021
@sandersn
sandersn merged commit f991637 into master Jun 28, 2021
@sandersn
sandersn deleted the make-requestidlecallback-work-with-4.4-dom branch June 28, 2021 20:06
@typescript-bot

Copy link
Copy Markdown
Contributor

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


type IdleCallbackHandle = number;

type IdleRequestCallback = (deadline: IdleDeadline) => void;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sandersn

What are you doing?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am pretty sure in TypeScript 4.4 IdleRequestCallback is not added, not even mentioning TypeScript 4.4 hasn't been released yet.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Untested Change This PR does not touch tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants