Comments (10)
I too came here through a eslint plugin which through a chain of dependencies and with npm v7 now installing peerDependencies
, ends up bloating my node_modules
with an unused typescript compiler:
[email protected]
┬ @typescript-eslint/[email protected]
└─┬ @typescript-eslint/[email protected]
└─┬ [email protected]
└── [email protected]
from tsutils.
If you don't have TypeScript installed, why would you install this package? Its sole purpose is to simplify using the TypeScript API.
@ajafff One use case: having an eslint-config package that supports different environments conditionally, like JavaScript projects (no TS required) and TypeScript projects at the same time (example). This currently leads to a warning because of tsutils
being included in packages like @typescript-eslint/eslint-plugin
:
warning "@typescript-eslint/eslint-plugin > [email protected]" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >=
3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
People keep having this issue because of tsutils
, unfortunately:
This is what peerDependenciesMeta was created for:
This allows you to integrate and interact with a variety of host packages without requiring all of them to be installed.
This would be the required change in package.json
:
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
Are you open to such a change?
from tsutils.
If you don't care about its version, just make it "typescript": "*"
from tsutils.
This package has a peerDependency on TypeScript, because it depends on TypeScript being present, but you need to bring your own version of it. (just in case someone reading this doesn't know what a peer dependency is)
It allows any stable version starting from 2.8.0
. the rest is there because removing it is a breaking change and there's no need to remove support for old nightly builds.
If you have TypeScript installed and your package manager complains about unmatched version, your package manager is broken.
If you don't have TypeScript installed, why would you install this package? Its sole purpose is to simplify using the TypeScript API.
from tsutils.
@ajafff I'm using TypeScript but its version much newer than you specified in its peerDependencies, hence it does not satisfy the semver.
Please, refer to semantic versioning doc and see that TypeScript v4 does not satisfy your >= v3 condition. The issue is still open.
from tsutils.
If you have TypeScript installed and your package manager complains about unmatched version, your package manager is broken.
cc @zkochan
from tsutils.
You probably use strict-peer-dependencies
pnpm is not broken. If the typescript version does not match the range specified in peer dependencies and strict-peer-dependencies
is set to true
, then pnpm will exit with an error.
This might cause an error on npm v7 as well.
from tsutils.
You probably use strict-peer-dependencies
Yes, I prefer fixing warnings, not ignoring them. I have a TypeScript v4 and when configuring typescript-eslint it complain about this package not having it in peerDependency.
from tsutils.
pnpm is not broken. If the typescript version does not match the range specified in peer dependencies
has anyone taken the time to investigate why typescript@4 would not satisfy >= 2.8.0
? I consider that broken behavior
from tsutils.
@ajafff we are considering any option, yes. There are more tools involved, and it is hard to find the culprit.
I checked the semver range here (https://semver.npmjs.com) and I can see that 4.2.4
is satisfied by >= 2.8.0
. So it is indeed a strange error not related to this package.
from tsutils.
Related Issues (20)
- feature: hasSuperMethod or isSuperMethodOverride HOT 2
- isValidJsxIdentifier: handle colon as namespace separator
- getJsDoc on EndOfFileToken should return comments usable with TypeChecker HOT 1
- Bad .d.ts file contents breaking tsc builds
- improve the readme HOT 1
- FIx typescript peer deps
- Add is*Type for newer types such as BigInt and TemplateLiteral? HOT 1
- isPropertyReadonlyInType fails for "interface J extends Readonly<I>"
- tsutils doesn't find typescript in monorepo HOT 1
- make peerDependency on typescript optional HOT 1
- Incorrect result from TSUtils.isTypeAssignableToString/Number
- Help maintaining this project? HOT 3
- `isReadonlyPropertyFromMappedType` throws error when `type.modifiersType` is `undefined`
- no type error when using a default import
- Typescript 5 support? HOT 2
- compile error with `exactOptionalPropertyTypes` compiler option enabled
- Get all identifiers that are typed as `any` in `.js` files.
- Is tsutils no longer maintained? HOT 1
- originalKeywordKind has been deprecated HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tsutils.