-
Notifications
You must be signed in to change notification settings - Fork 233
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
Duplicated identifier Errors with TypeScript #110
Comments
We briefly had s release where we published a version that had a pinned version of the None-the-less, as part of our package, we require the react type definitions, so we need to include it as a dependency. I'm not sure what the alternatives are that could avoid this circumstance from occurring? Happy to hear suggestions. |
I think the problem should be solve by moving the See also: https://docs.npmjs.com/files/package.json#devdependencies |
If my type definitions have a dependency on another packages type definitions, then should they not be a dependency of my package? Genuinely asking as I'm not a typescript use myself. I can see that they could be considered a peer dependency, similar to |
I'm also new to TypeScript but when i look around I can only find projects which have their When I use TypeScript I already have the |
Sorry for the delayed response. You would only have the dependency installed if it was a library you were already using (which is likely in this case, but potentially not for all libraries out there). Assuming the depenency is a a compatible sevmer range, it the npm install should resolve to the same instance. If they are not compatibile, then you would have a problem anyway, even if it was a Conversely, the cost of installing some type dependencies when you don't want them is pretty small. |
After doing some more research I found this ticket which says that it is the correct way to use At the end there are also some people which have compatibility issues when the Is it possible to change the |
From my understanding of semver ranges, I use a bot for keeping dependency versions up to date, so I'm not sure if that will roll through a push it back up to latest again if we open up the range a bit more. |
As far as I can see you can configure your bot to exclude dependencies: enable |
I have the same problem. |
I have updated the version range in version 2 to be I'll close this now, but please let me know if this is still causing issues so we can try again at fixing it. |
I use version 2.0.1 and the issue still appears. |
@mpeyper same issue. Using: @testing-library/[email protected]
Maybe add it as an optional dependency? |
* Fixing build caused by @testing-library/react-hooks testing-library/react-hooks-testing-library#110
Clearly there is more to be done here. @atomicpages (or anyone), are you able to run |
Running dedupe works (how I got around it in the first place 😉). But it is a pretty bad side effect, not 100% sure how this can be resolved permanently. |
For anyone following this issue, I'm thinking we're going to follow the path of some other testing-library packages and move the types to DefinitelyTyped and make them a dependency here. To be honest, I don't know how it is any different from what we're currently doing (other than moving the dependencies in a layer) or that it will make this situation any better, but I'm not seeing any complaints on the approach in the other package repos. Happy for anyone to take the reigns on either the DefinatelyTyped side or the relevant changes here. |
For anyone following this, I've created the PR to add the type definitions to DefinitelyTyped -> DefinitelyTyped/DefinitelyTyped#38715 |
The DefinitelyTyped changes went out in v2.0.2. Please update and let me know if there are still any issues. |
Could you document this as a breaking change in the 2.0.2 patch notes? |
Apologies about missing the release notes (I forgot to push the tags so didn't have that as a trigger to update them). I've updated them now. I went with a non-breaking change version bump as the type definitions have not changed, just moved and it is hopefully resolving an issue some people are seeing on the current version. For anyone not having this issue, there should be no changes required. |
I see this closed with nothing changed?
Any suggestions on how to use this library without getting silly errors like
? |
Hi @pvinis, If you have any links to documentation or even articles on the best practice around this subject I'll happily read them and reconsider, however I did put quite a bit of effort into trying to understand the behaviour of this and replicating how type dependencies are when built by the DefinatelyTyped repo and am fairly comfortable with the approach we are currently taking. I am aware of an issue with dependency resolution in yarn vs npm (#610) so perhaps that is what you are running into? If you want to share more details about your setup (perhaps in a new issue) I'll happily dig in and see if there is a simple fix or workaround for you. |
I guess the one I can point to is microsoft/types-publisher#81 (comment). A lot of other discussions are basically this:
My question would be, do we need that in there? I will try to do a RN init and and try to repro. |
Hm... in a new repo, I don't get the same problems, but I also see that it's using react 17. I will look into it, maybe our repo with 16 has some issues? |
Cleaning node_modules fixed it 🙈. |
Personally, I just avoid TS at every possible opportunity, the stuff of nightmares. |
react-hooks-testing-library
version: 1.0.4react-test-renderer
version: 16.8.6react
version: 16.8.17@types/react
version: 16.8.17typescript
version: 3.3.3333node
version: 11.9.0npm
version: 6.7.0Relevant code or config:
-
What you did:
I installed the latest Version of
react-hooks-testing-library
and got after atypecheck
the following error.What happened:
Reproduction:
Problem description:
The issue is that I use the
@types/react: 16.8.17
while this library uses@types/react: 16.8.22
which results in 2 different installed@types/react
versions. After updating to the latest@types/react
the problem was solved.Suggested solution:
There should be any typescript dependency installen when I install this package.
The text was updated successfully, but these errors were encountered: