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

Dependencies on @types/* requires just as much user attention as not having the dependency #620

Closed
eps1lon opened this issue Mar 23, 2020 · 6 comments
Labels
needs discussion Whether changes are needed is still undecided and additional discussion is needed.

Comments

@eps1lon
Copy link
Member

eps1lon commented Mar 23, 2020

The goal of having @types/ in our dependencies is so that users don't have to manually add them.

This has four downsides:

  1. Assuming best case scenario where @types/testing-library__dom is up-to-date: @testing-library/dom gets an update. We yarn upgrade @testing-library/dom. @types/testing_library__dom is not automatically updated because of lockfiles. Same issue with yarn add @testing-library@the-new-version-release
  2. To get an update, downstream consumers either have to nuke their lockfile (bad) or manually bump them. Automatic solutions like renovate or dependabot do not update transitive dependencies but only top-level ones. This means @types/testing_libray__dom won't get automatic updates.
  3. On a major we have to do a lot of manual maintenance to get types to downstream packages: Release major, Update types, update @types/testing-library__dom in our packages.json (fix: Bump types dom-testing-library#495)
  4. We depend on @types/testing-library__dom twice: Once by depending on @testing-library/dom -> @types/testing-library__dom and by depending on @types/testing-library__react -> @types/testing-library__dom. This could result in two different versions of @types/testing-library__dom. Can be resolved by nuking lockfile or npx yarn-deduplicate.

All of these issues can be resolved manually but require a lot more knowledge than "add @types/testing-library__react to your dev-dependencies" which is already the standard in the ecosystem.

I propose we get rid of the entry and advise users to manually add it. This is a lot easier since it's what typescript users are already used to (adding @types/ to devDependencies) vs requiring to maintain their lockfile.

This is a breaking change for type consumers. Type related breaking changes are a lot less severe since every type related change is a breaking change

@eps1lon eps1lon added the needs discussion Whether changes are needed is still undecided and additional discussion is needed. label Mar 23, 2020
@kentcdodds
Copy link
Member

Same thoughts apply: testing-library/dom-testing-library#494 (comment)

@pietia

This comment has been minimized.

@eps1lon

This comment has been minimized.

@SimenB

This comment has been minimized.

@radfahrer
Copy link

Another option would be to make it a peer dependency.

@kentcdodds
Copy link
Member

We don't actually have @types/testing-library__react anymore, so this can be closed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs discussion Whether changes are needed is still undecided and additional discussion is needed.
Projects
None yet
Development

No branches or pull requests

5 participants