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

Make @types/node a dev dependency on jest-worker #12544

Closed
wants to merge 1 commit into from

Conversation

donatj
Copy link

@donatj donatj commented Mar 3, 2022

Summary

npm requiring the jest-worker package is also requiring @types/node. This causes TypeScript to include @types/node for non-node projects.

This is a problem because a number of things are different between the DOM and npm. Namely in a browser setTimeout returns a number instead of a handle.

Test plan

No code changes

@facebook-github-bot
Copy link
Contributor

Hi @donatj!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@donatj
Copy link
Author

donatj commented Mar 3, 2022

I have now signed the CLA

@donatj donatj changed the title Make @types/node a dev dependency Make @types/node a dev dependency on jest-worker Mar 3, 2022
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@donatj
Copy link
Author

donatj commented Mar 7, 2022

There was a question on here by a user named Feng Yu that seems to have disappeared asking me to elaborate on the problem.

I've created a tiny project to help illustrate the problem

https://github.com/donatj/jest-worker-problem-example

The actual code we're compiling is just

var x : number = setTimeout(() => console.log("foo"), 1000);

You can see that without jest-worker included this compiles fine

With jest-worker included this fails to compile because including jest-worker includes @types/node which redefines setTimeout.

@F3n67u
Copy link
Contributor

F3n67u commented Mar 8, 2022

There was a question on here by a user named Feng Yu that seems to have disappeared asking me to elaborate on the problem.

I've created a tiny project to help illustrate the problem

https://github.com/donatj/jest-worker-problem-example

The actual code we're compiling is just

var x : number = setTimeout(() => console.log("foo"), 1000);

You can see that without jest-worker included this compiles fine

With jest-worker included this fails to compile because including jest-worker includes @types/node which redefines setTimeout.

Thanks for the detail. I deleted my original comment after I realize what the problem is. I am sorry for that.

@github-actions
Copy link

github-actions bot commented Jun 6, 2022

This PR is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Jun 6, 2022
@github-actions
Copy link

github-actions bot commented Jul 6, 2022

This PR was closed because it has been stalled for 14 days with no activity. Please open a new PR if the issue is still relevant, linking to this one.

@github-actions github-actions bot closed this Jul 6, 2022
@github-actions
Copy link

github-actions bot commented Jul 6, 2022

This PR was closed because it has been stalled for 14 days with no activity. Please open a new PR if the issue is still relevant, linking to this one.

@github-actions
Copy link

github-actions bot commented Aug 6, 2022

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants