-
Notifications
You must be signed in to change notification settings - Fork 12.8k
types in transitive dependencies causing errors. The inferred type of ... cannot be named without a reference to #36800
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
Comments
Is there a repo or something we can look at? The description is good but it's going to be very, very difficult to reconstruct something similar to what you have |
Eh. I'll try to do repro tomorrow. Shouldn't be very hard I assume. We have like 100 these "type annotations" in order to resolve these issues and it's super annoying and rather random. |
It's not about versions here, it's about nesting. You said it yourself, In the process of making declarations for |
@weswigham I think I understand what you mean. As far as I recall now (I'm from phone and 2AM) I have styled.ts file, in which I have some styled-components. |
BTW. Adding somewhere in docs a good nicely written explanation with examples of that particular topic will be super awesome and useful in order to explain that behavior using it and to get better understanding of this situation i.e. "whens and whys" for broad audience plus to mitigate yet another duplicates of this and similar issues :) I'll try to make a repro anyway and so you can approve whether it's intentional behavior or a bug so we can close this one for good. |
@RIP21 any update? |
@Bessonov never had time for repro because this one is just design flaw or whatever, you name it. And if you're asking me about whether it will be fixed, it won't I think, and I'm creator of the issue not a member of TS team :) |
- testing-library/react-testing-library#587 - microsoft/TypeScript#36800 - Directly add indirect type deps required by testing utils
TypeScript Version: 3.7.5. or 3.9.0-dev.20200214 (same result)
Search Terms:
symlink, rush, yarn, pnpm, not portable
Code
I'm using Rush that is heavy on symlinks.
I have sure thing only one version of typings of problematic packages as per my
yarn.lock
file.Same with TL/R
tsconfig.json
I have a package
B
, that uses a function from libraryA
that is also in my monorepo, that uses@types/testing-library__react
that uses@types/testing-library__dom
.So
B => A => testing-library-react => testing-library-dom
library
A
emits declarations, no problem. (when I settsconfig
to havepreserveSymlinks
, before, I had the same kind of error forA
)B
uses function fromA
, tries to generate its own declarations, sametsconfig
.Expected behavior:
B
generates declarations without errors.Actual behavior:
B
fails withThis happens with
yarn
as well as withpnpm
and I never check withnpm
.I know the behavior of TS that does that when there are multiple versions of typings and the compiler cannot guess which one is right and decides to error out instead. It's all good, but here I have 100% the same version of typings everywhere physically on the disk and in
yarn.lock
and it's probably a bug. It's just I have one that is symlinked and deep, and one that is laying around innode_modules/@types/testing-library__dom
and one that is nested in my symlinked package that makes itnode_modules/@package/A/node_modules/@types/testing-library__dom
So there are indeed two versions physically (copies), but they are exactly the same as per
yarn.lock
so it should emit correctly based on theirpackage.json
without additional clarification/annotation? Isn't it?Adding this to file in
B
fixes it tho, but it's a hack and I don't want to relate on them :(And working with monorepo this happens to me ALL THE TIME quite randomly :(
Related Issues:
#30858
The text was updated successfully, but these errors were encountered: