Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jonasgeiler
Copy link
Contributor

@jonasgeiler jonasgeiler commented Oct 17, 2025

A worker thread can throw anything via the throw keyword, which gets passed directly to 'error' event listeners. The event typings should not assume it is an Error object.

I am not sure if this is a breaking change, so I left the package.json version unmodified for now.


If changing an existing definition:

  • Provide a URL to documentation or source code which provides context for the suggested changes:

    I have opened a PR for Node.js to reflect this in their documentation: doc: use any for worker_threads.Worker 'error' event argument err nodejs/node#60300

    However, here is also a script proofing this should be changed:

    import { isMainThread, Worker } from "node:worker_threads";
    
    if (isMainThread) {
    	// Main thread.
    
    	const worker = new Worker(new URL(import.meta.url));
    
    	worker.on("error", (err /* Type is `Error`, but should be `unknown`. */) => {
    		console.log(typeof err); // Prints 'boolean'.
    	});
    } else {
    	// Worker thread.
    
    	throw false; // You can literally throw anything.
    }
  • If this PR brings the type definitions up to date with a new version of the JS library, update the version number in the package.json.

…gument `err`

A worker can throw anything via the `throw` keyword, which gets passed directly to 'error' event listeners. The event type should not assume it is an `Error` object.
@typescript-bot
Copy link
Contributor

typescript-bot commented Oct 17, 2025

@jonasgeiler Thank you for submitting this PR!

This is a live comment that 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 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.

Inactive

This PR has been inactive for 23 days — it is considered nearly abandoned!


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 73919,
  "author": "jonasgeiler",
  "headCommitOid": "3b6a4ddb38621d9aef7c65219e75239409908861",
  "mergeBaseOid": "d5dcfe8db3c38034efa60d74df3e87800e43e507",
  "lastPushDate": "2025-10-17T17:26:05.000Z",
  "lastActivityDate": "2025-12-10T19:04:32.000Z",
  "hasMergeConflict": true,
  "isFirstContribution": false,
  "tooManyFiles": false,
  "hugeChange": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "node",
      "kind": "edit",
      "files": [
        {
          "path": "types/node/v20/worker_threads.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/v22/worker_threads.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/worker_threads.d.ts",
          "kind": "definition"
        }
      ],
      "owners": [
        "Microsoft",
        "jkomyno",
        "r3nya",
        "btoueg",
        "touffy",
        "mohsen1",
        "galkin",
        "eps1lon",
        "WilcoBakker",
        "chyzwar",
        "trivikr",
        "yoursunny",
        "qwelias",
        "ExE-Boss",
        "peterblazejewicz",
        "addaleax",
        "victorperin",
        "NodeJS",
        "LinusU",
        "wafuwafu13",
        "mcollina",
        "Semigradsky",
        "Renegade334",
        "anonrig"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "changereq",
      "reviewer": "Renegade334",
      "date": "2025-11-11T22:11:19.000Z"
    }
  ],
  "mainBotCommentID": 3416453515,
  "ciResult": "pass"
}

@typescript-bot
Copy link
Contributor

🔔 @microsoft @jkomyno @r3nya @btoueg @Touffy @mohsen1 @galkin @eps1lon @WilcoBakker @chyzwar @trivikr @yoursunny @qwelias @ExE-Boss @peterblazejewicz @addaleax @victorperin @nodejs @LinusU @wafuwafu13 @mcollina @Semigradsky @Renegade334 @anonrig — 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 moved this from Waiting for Code Reviews to Needs Maintainer Review in Pull Request Status Board Oct 17, 2025
Copy link
Contributor

@Renegade334 Renegade334 left a comment

Choose a reason for hiding this comment

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

This is accurate, and we already do something similar for eg. process.on('unhandledRejection').

Two observations:

  • Firstly, this exists like it is in DT because this is how the API is documented. In general, when it comes to behavioural inaccuracies, we ask that people also upstream fixes to the API documentation, otherwise we're just doing our own thing.
  • I think this should probably be merged as a major change, as this will be breaking for anyone consuming the error parameter in callbacks. This can't be expressed in a PR, but if you're happy, I'll add this commit to the v25 changeset.

@jonasgeiler
Copy link
Contributor Author

@Renegade334

  • Firstly, this exists like it is in DT because this is how the API is documented. In general, when it comes to behavioural inaccuracies, we ask that people also upstream fixes to the API documentation, otherwise we're just doing our own thing.

As I have mentioned above, I have already opened a PR to the Node.js Documentation here: nodejs/node#60300
If you want, I can convert this PR to a draft until that PR gets hopefully merged.

  • I think this should probably be merged as a major change, as this will be breaking for anyone consuming the error parameter in callbacks. This can't be expressed in a PR, but if you're happy, I'll add this commit to the v25 changeset.

Sounds good! That would work for me.

@Renegade334
Copy link
Contributor

As I have mentioned above, I have already opened a PR to the Node.js Documentation here: nodejs/node#60300

So sorry, I'm conditioned to not reading the boilerplate text! 🤦

@sheetalkamat sheetalkamat moved this from Needs Maintainer Review to Waiting for Code Reviews (Blessed) in Pull Request Status Board Oct 17, 2025
@jonasgeiler
Copy link
Contributor Author

Update: My PR to the Node.js documentation, nodejs/node#60300, has been merged!

@typescript-bot typescript-bot added the Unreviewed No one showed up to review this PR, so it'll be reviewed by a DT maintainer. label Oct 28, 2025
@typescript-bot
Copy link
Contributor

Re-ping @microsoft, @jkomyno, @r3nya, @btoueg, @Touffy, @mohsen1, @galkin, @eps1lon, @WilcoBakker, @chyzwar, @trivikr, @yoursunny, @qwelias, @ExE-Boss, @peterblazejewicz, @addaleax, @victorperin, @nodejs, @LinusU, @wafuwafu13, @mcollina, @Semigradsky, @Renegade334, @anonrig:

This PR has been out for over a week, yet I haven't seen any reviews.

Could someone please give it some attention? Thanks!

@typescript-bot
Copy link
Contributor

It has been more than two weeks and this PR still has no reviews.

I'll bump it to the DT maintainer queue. Thank you for your patience, @jonasgeiler.

(Ping @microsoft, @jkomyno, @r3nya, @btoueg, @Touffy, @mohsen1, @galkin, @eps1lon, @WilcoBakker, @chyzwar, @trivikr, @yoursunny, @qwelias, @ExE-Boss, @peterblazejewicz, @addaleax, @victorperin, @nodejs, @LinusU, @wafuwafu13, @mcollina, @Semigradsky, @Renegade334, @anonrig.)

@typescript-bot typescript-bot moved this from Waiting for Code Reviews (Blessed) to Needs Maintainer Action in Pull Request Status Board Nov 4, 2025
@Renegade334
Copy link
Contributor

Merged into #73924, and will be visible in the v25 release. 👍

I'm going to mark this PR as non-mergable just to avoid confusion.

Copy link
Contributor

@Renegade334 Renegade334 left a comment

Choose a reason for hiding this comment

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

Thanks again!

@typescript-bot typescript-bot added Revision needed This PR needs code changes before it can be merged. and removed Unreviewed No one showed up to review this PR, so it'll be reviewed by a DT maintainer. labels Nov 11, 2025
@typescript-bot
Copy link
Contributor

@jonasgeiler One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits. Thank you!

@typescript-bot typescript-bot moved this from Needs Maintainer Action to Needs Author Action in Pull Request Status Board Nov 11, 2025
@typescript-bot
Copy link
Contributor

@jonasgeiler I haven't seen any activity on this PR in more than three weeks, and it still has problems that prevent it from being merged. The PR will be closed on Dec 11th (in a week) if the issues aren't addressed.

@typescript-bot typescript-bot added the Abandoned This PR had no activity for a long time, and is considered abandoned label Dec 5, 2025
@jonasgeiler
Copy link
Contributor Author

Uhm I am not sure about the state of this PR...

@Renegade334 do I do anything?

@typescript-bot typescript-bot added Has Merge Conflict This PR can't be merged because it has a merge conflict. The author needs to update it. and removed Abandoned This PR had no activity for a long time, and is considered abandoned labels Dec 5, 2025
@typescript-bot
Copy link
Contributor

@jonasgeiler Unfortunately, this pull request currently has a merge conflict 😥. Please update your PR branch to be up-to-date with respect to master. Have a nice day!

@Renegade334
Copy link
Contributor

Merged to the new v25 release as f482b2a. This PR can be closed.

Many thanks!

@typescript-bot typescript-bot added the Abandoned This PR had no activity for a long time, and is considered abandoned label Jan 3, 2026
@typescript-bot
Copy link
Contributor

@jonasgeiler I haven't seen any activity on this PR in more than three weeks, and it still has problems that prevent it from being merged. The PR will be closed on Jan 9th (in a week) if the issues aren't addressed.

@jonasgeiler jonasgeiler closed this Jan 3, 2026
@jonasgeiler jonasgeiler reopened this Jan 3, 2026
@jonasgeiler
Copy link
Contributor Author

@typescript-bot Not abandoned, but handled in a different PR. See ya.

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

Labels

Abandoned This PR had no activity for a long time, and is considered abandoned Critical package Has Merge Conflict This PR can't be merged because it has a merge conflict. The author needs to update it. Revision needed This PR needs code changes before it can be merged. Untested Change This PR does not touch tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants