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

@types packages should be peerDependencies #3108

Closed
Feiyang1 opened this issue Sep 11, 2019 · 9 comments · Fixed by #3395
Closed

@types packages should be peerDependencies #3108

Feiyang1 opened this issue Sep 11, 2019 · 9 comments · Fixed by #3395

Comments

@Feiyang1
Copy link

Feiyang1 commented Sep 11, 2019

Expected Behavior / Situation

@types packages should be peerDependencies.
I'd like to enforce Node 8 support in my project, but rollup includes @types/node@12 which introduce globals/types that are only available in newer Node versions, e.g. Promise.prototype.finally.

Actual Behavior / Situation

@types packages are the direct dependency of rollup introducing undesirable global types from @types/node.

Modification Proposal

The issue is similar to #2580
You mentioned that making @types packages devDeps is not an option because rollup reexport some of those types, but you can make them peerDependencies, so the consumer has control over the version of @types packages.

If the proposal sounds reasonable to you, I will create a PR for it.

@Feiyang1
Copy link
Author

I think long term rollup should not depend on types that define globals, e.g. @types/node, which forces consumers to include types they don't intend to include during compilation.

@lukastaegert
Copy link
Member

The problem is that making it a peerDependency would force EVERYONE to either install them manually or have warnings during install, which is also undesired. I fear the only reasonable way to handle this that I can think of is try to get rid of this dependency altogether, not sure if this is possible in any way.

@shellscape
Copy link
Contributor

We could drop that into optionalDependencies but that's a mostly declarative, symbolic move. We certainly wouldn't want to force non-TypeScript users to receive warnings during install.

@tivac
Copy link
Contributor

tivac commented Sep 11, 2019

Why is that package needed? As a non-TS user I've never understood its inclusion.

@Feiyang1
Copy link
Author

An alternative is make a @types/rollup package and do not export types from rollup package.
People who want the types can install @types/rollup and I can work around the globals issue by not installing it.
It's also a win for non-TS user who then won't be forced to install types.

@Feiyang1
Copy link
Author

Feiyang1 commented Oct 4, 2019

#3131 solved my problem, but rollup regressed on 1.23.0

@lukastaegert
Copy link
Member

Sorry, fix is upcoming

@lukastaegert
Copy link
Member

Rollup@2 will finally fix this for good: #3395

@lukastaegert
Copy link
Member

Solved in rollup@2.0.0

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

Successfully merging a pull request may close this issue.

4 participants