upgrade rxjs 6 to 7 lead to typescript errors

Viewed 4028

app starting point versions:

  • angular: 11.2.14
  • typescript: 4.0.7
  • rxjs: 6.X

I wanted to update rxjs library to the latest version(7.1.0), so I did npm install rxjs@latest and then running ng serve. then I got many errors, looks like a typescript issue. example here: https://i.stack.imgur.com/P6dHW.png

There is a way to solve it without giving a type to every rxjs operation returning value? (worked ok without giving types with rxjs 6)

1 Answers

In #RxJS v7.2.0, all operators are exported from rxjs. Importing from rxjs/operators will be deprecated soon.

Below is the script I wrote to help you with the migration.

You can migrate now, and forbid the import using eslint.

Down pointing backhand indexDown pointing backhand index Magic wand

`npx bye-bye-rx-operators-path`
Related