dotansimha / graphql-code-generator

A tool for generating code based on a GraphQL schema and GraphQL operations (query/mutation/subscription), with flexible support for custom plugins.
https://the-guild.dev/graphql/codegen/
MIT License
10.88k stars 1.34k forks source link

Relax tslib dependency version #9559

Open wereHamster opened 1 year ago

wereHamster commented 1 year ago

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

Change tslib version constraint from "~2.5.0" to "^2.5.0"

Describe alternatives you've considered

Disable "importHelpers" TypeScript option because code duplication in commandline tools (that are used for development only, not even at runtime) is less of an issue than in packages which end up in client bundles.

Is your feature request related to a problem? Please describe.

I am having issues upgrading some other packages in my monorepo because yarn installs multiple versions of tslib (1.1.x, 2.5.x, 2.6.x) which then cause typescript errors.

amakhrov commented 1 month ago

related to https://github.com/dotansimha/graphql-code-generator/issues/8857 (I think the solution proposed here would resolve the linked issue as well)

ardatan commented 1 month ago

Disabling importHelpers will end up multiple definitions of the same stuff. even multiple tslib versions will cause less duplications. Using a ranged version with "^" would be better in my opinion. Also I am wondering what kind of typescript errors you have, could you create a reproduction?

amakhrov commented 1 month ago

Not sure about the OP's case.

In our case, no TS errors. We've got some inconsistency with yarn modules resolution after an upgrade for the root project tslib. This may or may not (more likely :) ) be caused by the deps from graphql-code-generator.

It just made me look more closely into the installed dependencies - and I realized we have quite a few different versions of tslib in node_modules.