-
Notifications
You must be signed in to change notification settings - Fork 30.5k
fix(node): use unknown for worker_threads.Worker 'error' event argument err
#73919
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
fix(node): use unknown for worker_threads.Worker 'error' event argument err
#73919
Conversation
…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.
|
@jonasgeiler Thank you for submitting this PR! This is a live comment that I will keep updated. 1 package in this PRCode ReviewsBecause 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
Once every item on this list is checked, I'll ask you for permission to merge and publish the changes. InactiveThis 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"
} |
|
🔔 @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 |
Renegade334
left a comment
There was a problem hiding this 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.
As I have mentioned above, I have already opened a PR to the Node.js Documentation here: nodejs/node#60300
Sounds good! That would work for me. |
So sorry, I'm conditioned to not reading the boilerplate text! 🤦 |
|
Update: My PR to the Node.js documentation, nodejs/node#60300, has been merged! |
|
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! |
|
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.) |
|
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. |
Renegade334
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again!
|
@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! |
|
@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. |
|
Uhm I am not sure about the state of this PR... @Renegade334 do I do anything? |
|
@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! |
|
Merged to the new v25 release as f482b2a. This PR can be closed. Many thanks! |
|
@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. |
|
@typescript-bot Not abandoned, but handled in a different PR. See ya. |
A worker thread can throw anything via the
throwkeyword, which gets passed directly to'error'event listeners. The event typings should not assume it is anErrorobject.I am not sure if this is a breaking change, so I left the
package.jsonversion unmodified for now.pnpm test <package to test>.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
anyforworker_threads.Worker'error' event argumenterrnodejs/node#60300However, here is also a script proofing this should be changed:
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.