-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
Suggestion: change @types/node dependencies to devDependencies #55519
Comments
In suggested scenario you'd need to install all Also auto-generated dependencies are provided as And lastly If you have something as |
My main issue here is with the node package because it's one we all need and having it as a dependency in other packages can cause version overlaps like I described. |
This seems like solving hypothetical problem in hypothetical conditions. And besides manually installed typings there are also for example automatically downloaded by vscode - these may be not happy about |
The point I'm trying to make here is that all |
For reference, this was discussed a few years ago in this The core of the issue is that there are two kinds of type declarations:
External declarations are local and should be marked as regular Then there are packages containing global declarations. They are a pain. And I agree that today these type declarations speficifically should be Full comment (I am still waiting for a satisfying answer since 2016):
My opinion is that Node/Mocha/otherLibWithGlobals declarations should be enabled through the The only notable change in 2021 is that the upcoming 4.5 version supports |
I'm confused because I've always installed my types dependencies as dev dependencies and they've always installed their own dependencies when I did that. I only do this so that they aren't installed when in production since, well, there's no point in doing that, and it saves some space. I've also always seen other projects do this so I thought this was the pattern as it always seemed logical to me. Also do note that I'm talking about personal projects and not public libraries, although I believe that libraries written in TypeScript should only have the As for the rest of your message, I agree that node types should be bundled with TypeScript and we should have a way to opt-in to them through the |
Changed the original topic and description of the issue to focus more on the |
I'd like to suggest changing the way
@types/node
is declared under other packages' dependency lists, since many packages have this installed and it's essential for basically all TS projects. If a package has this as a dependency, it's possible you may run into outdated versions of the node package and issues because of that (which has happened to me before).Just to show how many packages have
@types/node
as a dependency, this is what I get when doingnpm ls @types/node
on my project (note that I do not even have it as a dev dependency myself due to this).It just so happens that they're all up to date in this example, but they could not be, and that's where I'm trying to get at. Having the dependency installed means users will not run into errors when trying to access things from node, but will do if their package is outdated and may be confused by this.
My suggestion is to replace all
@types/node
dependencies with devDependencies so that they are no longer installed when you install the main package in your project.Hope that explanation made sense and I'd love to hear your feedback on this and will open the PR if maintainers agree with this.
The text was updated successfully, but these errors were encountered: