TS rxjs-compat doesn't support prototype operators?

100 Views Asked by At

I'm following this migration guide to update from rxjs 5.5.5 to 6..**. It looks from this article and many other posts that simply having rxjs-compat in my project will allow to migrate step-by-step. Even worse it seems to work for everyone else. What I understand is that rxjs-compat will allow me to use both pipeable operators as well as Observable prototype operators. But either this is not the case with rxjs-compat or something is wrong.

So my expectation is for instance that I can use map in both forms when observable is imported from rxjs. But I get the following error "error TS2339: Property 'map' does not exist on type 'Observable'.". Which of course means that typings are incorrect.

import {of} from 'rxjs';
import {map} from 'rxjs/operators';

const arr$ = of([1, 2, 3, 4]);
arr$.map(x=> console.log(x));
arr$.pipe(
    map(x => console.log(x))
);

I've tried different versions of typescript (2.7.2,2.9.1,3.1.1) also rxjs and rxjs-compat starting from 6.0.0 till the latest vesrion. Also tried playing with tsconfig paths and aliasing rxjs to rxjs-compat but its never enough.

So just tell me the truth, does it really support prototype operators. Do I need some additional config? some matching versions? anything?

I can provide additional info if needed (package.json, tsconfig, etc).

this is setup that can be downloaded for testing. Locally I just run tsc index and it fails

0

There are 0 best solutions below