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

node: Add missing typings for AbortSignal in node #61412

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

segevfiner
Copy link
Contributor

@segevfiner segevfiner commented Jul 22, 2022

Add missing typings for AbortSignal in node

This still omits the static abort * timeout methods as they are not currently declared in TypeScript's lib. Based on definitions included with TypeScript.

Fixes #60868

Select one of these and delete the others:

If changing an existing definition:

@typescript-bot
Copy link
Contributor

typescript-bot commented Jul 22, 2022

@segevfiner Thank you for submitting this PR! I see this is your first time submitting to DefinitelyTyped 👋 — I'm the local bot who will help you through the process of getting things through.

This is a live comment which I will keep updated.

1 package in this PR

Code Reviews

Because this is a widely-used package, a DT maintainer will need to review it before it can be merged.

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

Status

  • ✅ No merge conflicts
  • 🕐 Continuous integration tests are still running
  • 🕐 Most recent commit is approved by a DT maintainer

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": 61412,
  "author": "segevfiner",
  "headCommitOid": "9768ac9ae2dcb726207fd45dea73286e98700c0a",
  "mergeBaseOid": "410e20e71e47ee719ec0504ee3c6b8c58245c141",
  "lastPushDate": "2022-07-22T18:33:48.000Z",
  "lastActivityDate": "2022-07-22T18:33:48.000Z",
  "hasMergeConflict": false,
  "isFirstContribution": true,
  "tooManyFiles": false,
  "hugeChange": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "node",
      "kind": "edit",
      "files": [
        {
          "path": "types/node/globals.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/test/globals.ts",
          "kind": "test"
        },
        {
          "path": "types/node/v14/globals.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/v14/test/globals.ts",
          "kind": "test"
        },
        {
          "path": "types/node/v16/globals.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/v16/test/globals.ts",
          "kind": "test"
        }
      ],
      "owners": [
        "Microsoft",
        "DefinitelyTyped",
        "jkomyno",
        "alvis",
        "r3nya",
        "btoueg",
        "smac89",
        "touffy",
        "DeividasBakanas",
        "eyqs",
        "Hannes-Magnusson-CK",
        "hoo29",
        "kjin",
        "ajafff",
        "islishude",
        "mwiktorczyk",
        "mohsen1",
        "n-e",
        "galkin",
        "parambirs",
        "eps1lon",
        "SimonSchick",
        "ThomasdenH",
        "WilcoBakker",
        "wwwy3y3",
        "samuela",
        "kuehlein",
        "bhongy",
        "chyzwar",
        "trivikr",
        "yoursunny",
        "qwelias",
        "ExE-Boss",
        "peterblazejewicz",
        "addaleax",
        "victorperin",
        "ZYSzys",
        "NodeJS",
        "LinusU",
        "wafuwafu13",
        "mcollina"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [],
  "mainBotCommentID": 1192628755,
  "ciResult": "unknown"
}

@typescript-bot typescript-bot added Critical package Untested Change This PR does not touch tests labels Jul 22, 2022
@typescript-bot typescript-bot added this to Waiting for Code Reviews in New Pull Request Status Board Jul 22, 2022
@typescript-bot typescript-bot added the The CI failed When GH Actions fails label Jul 22, 2022
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Author Action in New Pull Request Status Board Jul 22, 2022
@typescript-bot
Copy link
Contributor

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

This still omits the static `abort` * `timeout` methods as they are not
currently declared in TypeScript's lib.

Fixes DefinitelyTyped#60868
@typescript-bot typescript-bot removed The CI failed When GH Actions fails Untested Change This PR does not touch tests labels Jul 22, 2022
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in New Pull Request Status Board Jul 22, 2022
@segevfiner segevfiner marked this pull request as draft July 22, 2022 19:09
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Author Action in New Pull Request Status Board Jul 22, 2022
@segevfiner
Copy link
Contributor Author

Bahhh. This depends on a lot of DOM types which I'm not sure what is the best way to handle. Which I guess is why this wasn't included in the first place. Duplicating them all under the NodeJS namespace perhaps? But if they change in the future...

@rangoo94
Copy link
Contributor

rangoo94 commented Jul 26, 2022

@segevfiner, I think it's better to duplicate them in Node.js types scope. Similar to the AbortController and AbortSignal - the implementation of DOMException and other DOM types is done explicitly for Node.js (i.e. DOMException source), so it will not necessarily conform to WHATWG DOM specs.

For example, AbortController in Node.js v14.x/v15.x was not matching the WHATWG spec, and even now it has some differences.

@tilgovi
Copy link

tilgovi commented Jul 26, 2022

If we copy the DOM types, we can also extend them with the statics, AbortSignal.abort and AbortSignal.timeout, because there's no need for TypeScript's DOM lib to have it if we're not depending on the DOM lib.

@segevfiner
Copy link
Contributor Author

The problem with adding the statics is that AbortSignal is defined in the same global scope so if lib.dom.d.ts is also included, TypeScript enforces that they must match.

@tilgovi
Copy link

tilgovi commented Jul 28, 2022

Understood. Thanks.

@meyfa
Copy link
Contributor

meyfa commented Oct 6, 2022

Is the problem with DOM types perhaps solved now, since #59905 has been merged?

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

Successfully merging this pull request may close these issues.

[@types/node] AbortSignal missing methods and events
5 participants