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

Not compatible with the latest 5.x release of TypeScript #125

Closed
zkanda opened this issue Mar 17, 2023 · 7 comments · Fixed by #134
Closed

Not compatible with the latest 5.x release of TypeScript #125

zkanda opened this issue Mar 17, 2023 · 7 comments · Fixed by #134
Labels
bug Something isn't working

Comments

@zkanda
Copy link

zkanda commented Mar 17, 2023

I'm getting a dependency resolution error on the latest tagged version. Perhaps the project wanna release a new version.

~/c/z/project-app ❯❯❯ npm install class-variance-authority                                                                                                                                             ✘ 1 main ✱
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/typescript
npm ERR!   peerOptional typescript@">=3.3.1" from [email protected]
npm ERR!   node_modules/eslint-config-next
npm ERR!     eslint-config-next@"13.2.4" from the root project
npm ERR!   peer 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" from [email protected]
npm ERR!   node_modules/tsutils
npm ERR!     tsutils@"^3.21.0" from @typescript-eslint/[email protected]
npm ERR!     node_modules/@typescript-eslint/typescript-estree
npm ERR!       @typescript-eslint/typescript-estree@"5.55.0" from @typescript-eslint/[email protected]
npm ERR!       node_modules/@typescript-eslint/parser
npm ERR!         @typescript-eslint/parser@"^5.42.0" from [email protected]
npm ERR!         node_modules/eslint-config-next
npm ERR!   2 more (the root project, ts-node)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional typescript@">= 4.5.5 < 5" from [email protected]
npm ERR! node_modules/class-variance-authority
npm ERR!   class-variance-authority@"0.4.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/typescript
npm ERR!   peerOptional typescript@">= 4.5.5 < 5" from [email protected]
npm ERR!   node_modules/class-variance-authority
npm ERR!     class-variance-authority@"0.4.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! /Users/zkanda/.npm/_logs/2023-03-17T06_53_53_092Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/zkanda/.npm/_logs/2023-03-17T06_53_53_092Z-debug-0.log

Thanks for this amazing project.

@zkanda zkanda added the bug Something isn't working label Mar 17, 2023
@hugo-vrijswijk
Copy link

I'm wondering why TypeScript is a peerDependency at all. Libraries shouldn't have it as a dependency if it's only used for building (and not doing anything with the actual ts compiler)

@Gravy59
Copy link

Gravy59 commented Mar 19, 2023

I'm wondering why TypeScript is a peerDependency at all. Libraries shouldn't have it as a dependency if it's only used for building (and not doing anything with the actual ts compiler)

I think it has to do with the fact that CVA is designed for TS, but there are always those who can't (or won't) use TS and still want to use CVA.

@Mejiabrayan
Copy link

Beat me to it. Also having the same issue 😭

@hugo-vrijswijk
Copy link

hugo-vrijswijk commented Mar 20, 2023

I think it has to do with the fact that CVA is designed for TS, but there are always those who can't (or won't) use TS and still want to use CVA.

For those cases simply publishing the type declarations is enough. There's no need for TypeScript to be a peer dependency if all you're doing is publishing types

@joe-bell
Copy link
Owner

joe-bell commented Mar 25, 2023

Hey gang!

Appreciate the enthusiasm to get the ball rolling on this, but I'm in strict vacation mode right now until mid-April.

I've been coding flat-out over the last year for work and during my free time – I don't get paid for my open-source work.
(I can't use GitHub Sponsors due to lack of taxation features outside of the US)


Quickly dropping in to answer the burning question:

I'm wondering why TypeScript is a peerDependency at all. Libraries shouldn't have it as a dependency if it's only used for building (and not doing anything with the actual ts compiler)

It's here to make sure that people using CVA with TypeScript are using a supported version (I would much rather close #127 in favour of a simple version bump to continue that trend)


Rest assured this will be fixed, and I'll tackle it as soon as I'm back from vacation. In the meantime I'd be grateful for a few weeks of patience 🙏

If you need a workaround in the meantime, check out options like pnpm patch

@domnantas
Copy link

domnantas commented Apr 1, 2023

It's a bit of a 🐥 and the 🥚 problem – it is impossible to work around it with pnpm patch or npx patch-package. Patches are only applied in postinstall, so it's too late because the error happens during the install. It is not possible to run patch-package on preinstall either, because patch-package and cva is not installed yet ds300/patch-package#49 (comment)

Not sure if there are any possible workarounds besides forking, downgrading TS, or using npm install --force locally and on CI for the time being. Totally understand you are on vacation and I wish you a good rest, I'm just surprised there are no mechanisms in JS to work around this 😅

@joe-bell
Copy link
Owner

joe-bell commented Apr 2, 2023

Shipped in 0.5.1 🚢


I'm still supposed to be on vacation right now, so please consider supporting the project if this release is useful to you!

Repository owner locked as resolved and limited conversation to collaborators Apr 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants