-
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
RXJS own d.ts file error #3654
Comments
With the issue including neither the version information nor the code that effects the errors, it's not possible to say precisely what the problem is. That's why the issue template should be filled out. However, those sorts of errors will be effected if v5-style imports are used when |
I am facing same issue. Installed rxjs 6 and in Observable.d.ts there is an import so do i need to install rxjs-compat always? |
btw when i try to run migration script: |
I am facing same issue after angular 6 update. |
@vytautas-pranskunas- @sachinpachori The errors disappeared for me when I've updated the import paths according to the migration guide: https://github.com/ReactiveX/rxjs/blob/master/MIGRATION.md#import-paths |
rxjs-tslint isn't picking up the migration changes necessary in rxjs |
and inside of Observable.d.ts, why do we need to |
I have rxjs 6.1.0 installed and after running the migration tool and using the rxjs-tslint I get the same error. Obviously if I add back the rxjs-compat node module, this error disappears and everything compiles fine.
|
I am also facing the same problem. node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'. |
@SnakeME In my case it didn't and I need to keep the rxjs-compat to get it working locally however now my build definition is failing and I am looking at it. |
In the meantime, a quick fix for me was to roll back to 5.x:
|
for me |
reinstalling rxjs and rxjs compat did the trick for me. "npm install --save rxjs@6 rxjs-compat@6". |
Problem is that rxjs-compat@6 will be depricated in v7. So question is if I want to remove rxjs-compat@6 how should i do this. To tell the truth i do not have it at the moment also so question is what should i do not depend on it - but not how to get rid of just that error. If you want just to ged rid of error add to typescript config skipLibCheck: true. |
I have cleaned the code and got it work. I avoid using rxjs-compat as well. Thanks. |
Have you released new version with cleaned code? |
@mrcampbell it's not possible to downgrade rxjs to 5.5.10 because this version is not supported by Angular v6 . |
how come these obvious issues not caught before releasing Angular6? |
This shouldn't be closed until the fix is in. |
This happens when you haven't updated other imports that require Subject etc. from the old location. Update the other imports in your other files and these will go away. |
@Son-Lam how did you exactly fix this though? |
@jamesclark92 Check your import paths https://github.com/ReactiveX/rxjs/blob/master/MIGRATION.md#import-paths When you have updated them the error should disappear. |
@jamesclark92 Yes I know, for me the errors disappeared when I've corrected the imports in my TypeScript files. It seems like rxjs is doing some kind of fallback or check when it detects that you are using an old import statement. |
I stand corrected with the error I was getting, the culprit was a package dependency that was using rxjs/Observable import. As soon as I updated to a more recent version that supported rxjs 6, the error went away and I was able to drop the rxjs-compat package. |
npm install --save rxjs@6 rxjs-compat@6
|
In order to minimize the impact of the upgrade, RxJS v6 releases with a sibling package, rxjs-compat, which provides a compatibility layer between the v6 and v5 APIs. Most developers with existing applications should upgrade by installing both rxjs and rxjs-compat at ^6.0.0: npm install rxjs@6 rxjs-compat@6 --save |
@dimkanewtown thanks for your last comment, how exactly did you determine which dependency was the culprit in your app? I have many dependencies that could be involved - do you have a quick way to find the needle in the haystack? |
@tobyStaff in my case I only had a few dependencies which I was able to check manually |
In my case it turned out that the So in summary this is what I did:
|
rxjs-compat is already kinda minimal and there is no point in developing multiple other versions. Simply install rxjs-compat and use it. |
From my understanding, installing In my case, with rxjs-compat I know this sounds like a small difference, but since tree-shake-ability is listed as reason number 2 (and 3) for the recent change in API, I'd like to be able to benefit from it. If I find a way to achive this, I'll post it here, but I'm not going to invest a lot of time in searching for this, as it is a small difference at the moment. |
I've managed to get a smaller |
Running |
package zone.js is not rxjs 6 compatible. There is an open issue : angular/zone.js#1091. Next release will probably correct that. |
Hi, I just reinstalled it: $npm install rxjs@6 rxjs-compat@6 --save and it worked on my end. |
I was having this error: I fixed it after finding the following import statement in app.module.ts. Upgrading 3rd party packages was part of the solution but search your code for "rxjs/" and you may find your issue like I did. |
Update: Perhaps this needs to be addressed by the folks testing and developing the rxjs linting tool?! Also, after updating a third party library which was still using old rxjs5 syntax, the list of errors related to its files disappeared. Unfortunately, not all the libraries which we're using in our project has updated to rxjs 6 syntax, so I'm stuck with rxjs-compat until they are all up to date. Thanks. |
this is because what version you are using of Angular CLI is V6 and what project you are using is of V5 or less than that. |
we need ti install rxjs and rxjs-compat packages to use the Observable. |
had the same issue when updated my project to angular 6. Got fixed by using "npm install rxjs@6 rxjs-compat@6 --save". |
@pleerock "import { Observable } from 'rxjs'; " worked for me thank you. |
npm install --save rxjs-compat@6 did the trick. Thanks guys! |
Still not working on my side!
Can someone provide a full explanation ? |
Hello all, not sure why this issue is closed. Installing |
Summary: Is this issue to be fixed by rxjs team? Why am I getting this error then? What if I searched all my code and I don't find reference to old rxjs 5 syntax, but still getting this error? Will installing rxjs-compat fix this issue, as suggested by many comments here? How do I upgrade my code to rxjs 6 syntax appropriately? Good Luck. |
yarn add rxjs@6.2.2 rxjs-compat@6.2.2 --S --E followed by 'yarn install' will fix. |
reinstalling rxjs and rxjs compat did the trick for me. "npm install --save rxjs@6 rxjs-compat@6". |
For those that are struggling to get rid of the ERROR in node_modules/rxjs/Rx.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat'. after you remove the compatibility layer.... All the people telling you to fix your paths are correct, but it would be better if they told you how to find them... I spent hours going through my code and couldn't find anything wrong: What Worked: Go to |
Hi guys I hope it is help |
this worked for me: #3654 (comment) |
npm i rxjs-compat |
I have the same issue with rxjs-compat. ERROR in node_modules/ngx-editor/app/ngx-editor/common/services/message.service. d.ts(1,10): error TS2305: Module '"C:/Users/frontend/node_modules/rx js/Observable"' has no exported member 'Observable'. |
rxjs-compat (compatibility package) is to temporarily let you use old rxjs 5 syntax code along side rxjs 6. You will need to remove it as a final step in your upgrade process. Have you used https://update.angular.io/? |
Guys, beware! Zone.js library has NOT updated their code to RxJS 6, yet!! My team is waiting on their RxJS 6 update PR to be merged before we are able to get rid of the rxjs-compat (comparability) package. This is an example of how relying on a major library can stop hundreds of projects from upgrading! smh |
What solved it for me was removing this import from all places: |
node_modules/rxjs/BehaviorSubject.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/BehaviorSubject'.
node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'.
node_modules/rxjs/Observer.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observer'.
node_modules/rxjs/ReplaySubject.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/ReplaySubject'.
node_modules/rxjs/Rx.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat'.
node_modules/rxjs/Subject.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Subject'.
node_modules/rxjs/Subscriber.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Subscriber'.
node_modules/rxjs/Subscription.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Subscription'.
node_modules/rxjs/observable/forkJoin.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/observable/forkJoin'.
node_modules/rxjs/observable/from.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/observable/from'.
node_modules/rxjs/operators/map.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/operators/map'.
node_modules/rxjs/operators/startWith.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/operators/startWith'.
RxJS version:
Code to reproduce:
Expected behavior:
Actual behavior:
Additional information:
The text was updated successfully, but these errors were encountered: