-
Notifications
You must be signed in to change notification settings - Fork 3k
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
TypeScript: Workaround to npm link
#1858
Comments
Is this something we should add to |
I'm not sure this is an issue with RxJS. Sounds like a TypeScript issue from the description |
as expressed my opinion on #1744, I also think this is mostly compiler behavior and not to be handled in RxJS code implementation (or documentation). Someone might use those as tips but wouldn't to be included in repo. what do you think, @david-driscoll ? |
Can you share some repro steps to get to the issue described above, these are probably bugs that need to be fixed. microsoft/TypeScript#6496 (and its predecessor microsoft/TypeScript#7755) are not about sym links, they are about treating diffrent versions of the same library as the same for assignment compat purposed for privarte/protected properties. i do not think there is an argument when they are exactly the same file on disk. |
@mhegazy I'm still having problems with TS 2.0.3. Where I used to get this error, now the compiler hangs for a long time and then crashes with a |
@david-driscoll, your fix seems to have addressed the issue I'm having. Thanks! I'll need to try more things to be sure, but for sure it solves the crash I described in my previous comment to @mhegazy. |
@xogeny can you share a project i can look at? |
@mhegazy I tried to create a simple case. So far, no luck. It builds just fine for the simple case. I understand that without a reproducible case, there isn't much you can do. I wonder if @david-driscoll might have one? Given my experience with the simple case, I'll try to figure out what is different between that case and the case that shows the issue. But I'll have to work it into my other work. But I'm 100% sure that with |
yeah, i could not get this to repro locally, so i assumed it is working :) if you can not share a sample, a directory structure + |
@mhegazy So I tried these suggestions. The I did a Apart from resolving the One thing to note. If I use So the workaround works for me for now. I may even switch to |
@xogeny can you share a repro project? |
@mhegazy Unfortunately, I cannot. This is work for a client, not an open source project. As I mentioned above, I tried to recreate the issue by creating other projects to mimic the structure of the repo that is showing this issue. But that doesn't reproduce the problem. After trying these CLI options, I still don't understand what it is that is special about this project. I'm keeping my eyes open for things that might allow me to reproduce this in a simpler case. But so far, no luck. |
I'm closing this for now, as shared I don't feel this need to be handled in plain use case documentation scenario. |
Workaround for typescript duplicate identifier errors when using npm link (to get preact-material-components typings branch) More info: microsoft/TypeScript#6496 Workaround: ReactiveX/rxjs#1858
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
RxJS version:
N/A
Code to reproduce:
npm link one project that is using rxjs with another project.
Expected behavior:
TypeScript Compiler should not throw errors
Actual behavior:
TypeScript Compiler does throw errors
Additional information:
There are problems when using
rxjs
with tools likenpm link
that cause the compiler to fail to resolve types properly and create lots of compiler errors, as it sees two copies of the same class, and they are not compatible.Workaround
I've found a workaround when using TS 2.0+ that appears to solve this problem, and it's fairly easy to configure.
Based on this information, we can use the new
path
based mapping to solve the problem.Adding the following to your tsconfig will make the issue go away, assuming your using the new TS 2.0 beta or the nightlys.
Related Issues
microsoft/TypeScript#6496
microsoft/TypeScript#7755
#1744
cc @Blesh @robwormald @kwonoj @staltz
cc @mhegazy @ahejlsberg - maybe this can be fixed easily in the compiler? 🙏
While this work around works, it's fairly painful that we have to make these changes, and post these work arounds.
Are there other simpler fixes? Can the compiler emit an identifier in the
.d.ts
files that so that it knows "hey this module is equal to this other module"?The text was updated successfully, but these errors were encountered: