Im trying to follow this tutorial, but I'm getting errors.
My dependencies:
"dependencies": {
"@angular/common": "2.0.0-rc.3",
"@angular/compiler": "2.0.0-rc.3",
"@angular/core": "2.0.0-rc.3",
"@angular/http": "2.0.0-rc.3",
"@angular/platform-browser": "2.0.0-rc.3",
"@angular/platform-browser-dynamic": "2.0.0-rc.3",
"@angular/platform-server": "2.0.0-rc.3",
"@angular/router": "3.0.0-beta.2",
"@angular/router-deprecated": "2.0.0-rc.2",
"nativescript-angular": "0.2.0",
"tns-core-modules": "^2.1.0"
},
Type 'Observable<{}>' is not assignable to type 'Observable', where it points to the line 'return o';
canDeactivate(): Observable<boolean> | boolean {
if (!this.crisis || this.crisis.name === this.editName) {
return true;
}
let p = this.dialogService.confirm('Discard changes?');
let o = Observable.fromPromise(p);
return o;
}
Can anyone guide me to fix these errors? thanks.
You could try casting:
canDeactivate(): Observable<boolean> | boolean {
if (!this.crisis || this.crisis.name === this.editName) {
return true;
}
let p = this.dialogService.confirm('Discard changes?');
let o = <Observable<boolean>>Observable.fromPromise(p);
return o;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With