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

fix: support automatic types in pnpm installs #540

Merged
merged 2 commits into from Dec 11, 2019

Conversation

aleclarson
Copy link
Contributor

When installed with pnpm, the @types/testing-library__react package cannot be used by packages that don't directly depend on it, so we need to re-export them.

@eps1lon
Copy link
Member

eps1lon commented Dec 4, 2019

I can't say anything to this particular change without an example repo.

It seems weird that pnpm requires this. It basically means that every package maintainer (which might have nothing to do with types/) need to add an index.d.ts now.

This adds a lot of friction. Honestly I'd rather remove the types dependency with the next breaking change so that we handle them just like any other package: If you want types and the package does not bundle them then you have to install them.

@bcarroll22
Copy link
Contributor

bcarroll22 commented Dec 4, 2019

Hmm yeah why is the types package a dependency? Would removing the dependency even be a breaking change? I don't think anything references them currently inside this package.

@eps1lon
Copy link
Member

eps1lon commented Dec 4, 2019

Hmm yeah why is the types package a dependency? Would removing the dependency even be a breaking change? I don't think anything references them currently inside this package.

It's used so that when installing @testing-library/react you don't need to install the types packages. It's automatically included.

But after thinking a bit more about this it's still not obvious why this change is necessary. I'm a bit worried this causes type conflicts. @aleclarson A complete repro would help a lot here.

When installed with pnpm, the @types/testing-library__react package cannot be used by packages that don't directly depend on it, so we need to re-export them.
@aleclarson
Copy link
Contributor Author

@aleclarson
Copy link
Contributor Author

It basically means that every package maintainer (which might have nothing to do with types/) need to add an index.d.ts now.

You might be confused. This pnpm incompatibility is caused by @types/testing-library__react being a transient dependency.

@eps1lon
Copy link
Member

eps1lon commented Dec 4, 2019

It basically means that every package maintainer (which might have nothing to do with types/) need to add an index.d.ts now.

You might be confused. This pnpm incompatibility is caused by @types/testing-library__react being a transient dependency.

I guess you mean transitive.

Thanks for the repro. So basically simply adding the @types/ package as a dependency isn't enough for zero-config types in pnpm because transitive dependencies are not hoisted up which would be the case for npm or yarn v1.

Tested with module hoisting as well as ts 3.6 and it seemed to work.

Friendly ping to @johnnyreilly since he had a great blog post that explained the strategy. I think the pnpm caveat should be mentioned.

Aside: I'll check out the kcd-scripts related failure.

@eps1lon
Copy link
Member

eps1lon commented Dec 4, 2019

Since we don't have a lockfile CI stays red until kentcdodds/kcd-scripts#107 is resolved.

@kentcdodds
Copy link
Member

I think I've fixed the issue in kcd-scripts. We we'll just need to upgrade that and we should be good to go.

@eps1lon eps1lon self-assigned this Dec 9, 2019
@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 9, 2019

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit b4888a8:

Sandbox Source
distracted-wave-iur6n Configuration
react-testing-library-examples Configuration

@eps1lon
Copy link
Member

eps1lon commented Dec 9, 2019

@kentcdodds The after_success script is always failing for fork PRs which means there will be no codecov report. However, this is a required check which means PRs can only be merged by admins not just members. Same issue for dom-testing-library.

@eps1lon eps1lon removed their assignment Dec 9, 2019
@kentcdodds
Copy link
Member

Thanks for tuning me into that @eps1lon! I've been wondering for months why the codecov bot wasn't showing up on PRs. Now I've finally figured it out. This should fix that: kentcdodds/kcd-scripts@ab38c66

Is this ready to be merged?

@kentcdodds kentcdodds merged commit 965db57 into testing-library:master Dec 11, 2019
@kentcdodds
Copy link
Member

🎉 This PR is included in version 9.3.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants