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

Destruction of TypeScript ecosystem on npm is expanding #32273

Closed
falsandtru opened this issue Jul 5, 2019 · 4 comments
Closed

Destruction of TypeScript ecosystem on npm is expanding #32273

falsandtru opened this issue Jul 5, 2019 · 4 comments
Labels
Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented.

Comments

@falsandtru
Copy link
Contributor

As I mentioned at #31148, unused @types files installed by node modules pollutes and breaks the main project. It is caused by del package at that time. Now this problem came to be spread by another major package npm-check-updates. This means the destruction of ecosystem is expanding. TypeScript must resolve the problem quickly. See a solution #18588 (comment).

@RyanCavanaugh RyanCavanaugh added the Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. label Jul 10, 2019
@falsandtru
Copy link
Contributor Author

My proposal is #18588 (comment). You just implement it.

@ExE-Boss
Copy link
Contributor

ExE-Boss commented Jul 22, 2019

I believe that the best option is to just use pnpm, which doesn’t have this problem, as packages are stored in isolated trees and are symlinked to each other.


pnpm file hierarchy for del@4.1.1:
(only relevant @types packages are included)

node_modules/
- del - .registry.npm.com/del/4.1.1/node_modules/del
- .registry.npmjs.com/
	- @types/
		- glob/
			- <version>/
				- node_modules/
					- @types/
						- glob/
						- node - ../../../../../@types/node/<version>/node_modules/@types/node
		- node/
	- del/
		- 4.1.1/
			- node_modules/
				- del/
				- @types/
					- glob - ../../../../../@types/glob/<version>/node_modules/@types/glob

TypeScript only looks into node_modules/@types/, not into node_modules/.registry.npmjs.com/@types/<package>/<version>/node_modules/@types/

@StreetStrider
Copy link

@ExE-Boss, hello. I came to this ticket by the opposite reason. I'm already using pnpm actively in my non-TS projects. However, when I try to install @types package in pnpm (with classic deps tree hierarchy) tsc rejects to resolve transient dependencies of such @types packages. Just to check my guess, I tried reinstalling with vanilla npm (flat deps). From that point tsc works OK, which means no errors in my typed code. However when I switch back with pnpm install tsc starts to nag again, like:

node_modules/@types/express/index.d.ts:19:23 - error TS2307: Cannot find module 'express-serve-static-core'.

19 import * as core from "express-serve-static-core";

(I depend on @types/express).
Have you faced similar issues (in past or present)? Is it my own issue which I should investigate further or tsc now hard depends on flat order of dependecies?

@StreetStrider
Copy link

Looks like my issue is #30858, but not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented.
Projects
None yet
Development

No branches or pull requests

4 participants