Closed bedag-moo closed 5 years ago
Thansk @bedag-moo - saved my day.
should be on readme first page
I was also looking into this issue for more than an hour until I found this issue. Thanks for pointing that out!
I am so glad I perused rxjs-tslint issues when this tool failed to update the operators... Thank you @bedag-moo
@bedag-moo thanks for pointing this out. I'll update the update guide and the readme of the project today.
@bedag-moo just went through a sample migration. When you run ng update @angular/core
, Angular CLI would install rxjs-compat
. PipeableOperatorsOnlyRule
will take the typings from there and the migration should go as expected.
I'll update the readme once again to reflect the findings.
After 3 months, my memory is a bit hazy ... I guess it is possible that I ran npm install rxjs@^6.0.0
rather than ng update
because I didn't realize that the phrase
Use ng update or your normal package manager tools to identify and update other dependencies.
was not meant to include rxjs.
In any case, rxjs-5-to-6-migrate
should error if it can not resolve the Observable type rather than silently doing nothing.
As recommended by the angular update guide, I updated to rxjs 6 before running rxjs-5-to-6-migrate.
rxjs-5-to-6-migrate ran without errors, and correctly fixed the imports, but left patched operator calls unchanged.
Looking at the implementation of the PipeableOperatorsOnlyRule.js, I noticed that is uses the typeChecker to identity instance operator calls. Suspecting that the type checker needs the source code to compile, and therefore the old rxjs in node_modules, I ran
and the patched operator calls were rewritten correctly.
Please consider emitting an error message if the wrong rxjs version is installed - if I hadn't seen rxjs-5-to-6-migrate rewrite patched operator calls in another project, I would have assumed it incapable of doing so, and missed out on a great feature.