Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile error using beta6

using rxjs beta2 my project works great, but updating to beta6 I get a long list of compile error:

component.ts(34,18): error TS2339: Property 'finally' does not exist on type 'Observable<T[]>'.
....
....
.component.ts(51,10): error TS2339: Property 'switchMap' does not exist on type 'Observable<Company>'.
....
....
service.ts(24,18): error TS2339: Property 'map' does not exist on type 'Observable<Response>'
....
....
node_modules/rxjs/add/observable/range.d.ts(2,16): error TS2435: Ambient modules cannot be nested in other modules.
node_modules/rxjs/add/observable/range.d.ts(2,16): error TS2436: Ambient module declaration cannot specify relative module name.
node_modules/rxjs/add/operator/catch.d.ts(2,16): error TS2435: Ambient modules cannot be nested in other modules.
node_modules/rxjs/add/operator/catch.d.ts(2,16): error TS2436: Ambient module declaration cannot specify relative m
..

I'm importing Observables like this:

import {Observable} from 'rxjs/Observable';

What am I doing wrong?

Thanks a lot

EDIT using rc1 rxjs beta6 works. But I had to cast the result on all my observables. Before I could use:

this._couseSourcesSvc.readAll ()
    .finally (() => sourcesSpinner.hide ())
    .subscribe (
        res => {
            this.sources = res;
        }

But now I have to use:

this._couseSourcesSvc.readAll ()
    .finally (() => sourcesSpinner.hide ())
    .subscribe (
        (res:Sources[]) => {
            this.sources = res;
        }

As you can see I have to cast the result or I get a compile error (res:Sources[])

Type '{}' is not assignable to type 'DocumentSource[]'.

Is this normal?

like image 678
user3471528 Avatar asked Dec 06 '25 07:12

user3471528


1 Answers

Only Angular2 rc.0 (which came out just last night) supports rx beta 6.

Upgrade your angular to release candidate 1 to be able to update RxJs.

Note you'll have to update your imports to @angular/core | @angular/http etc. The name has changed from angular2/*

like image 188
Mark Pieszak - Trilon.io Avatar answered Dec 09 '25 23:12

Mark Pieszak - Trilon.io



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!