2017-07-18 3 views
0

Ich habe diesen Fehler: Der 'Dies' Kontext des Typs 'Aktionen' ist nicht zu Method 'Dies' vom Typ 'Observable' zuweisbar. Arten von Eigentum 'Lift' sind nicht kompatibel.Fehler beim Aktualisieren von Typescript in @ ngrx/Effekte

für diese Datei:

import { Injectable } from '@angular/core'; 
import { Effect, Actions } from '@ngrx/effects'; 
import 'rxjs/add/operator/switchMap'; 

import { TouristZoneModel } from '../../tourist-zones/shared/tourist-zone.model'; 
import { TouristZoneActions } from '../actions/touristzone-action-creator'; 
import { TouristZoneService } from '../../tourist-zones/shared/tourist-zone.service'; 

@Injectable() 
export class TouristZoneEffects { 

    @Effect() loadTouristZones$ = this.actions$ 
    .ofType(TouristZoneActions.LOAD_TOURISTZONES) 
    .map(action => action.payload) 
    .switchMap((provincePath: string) => this.svc.getTouristZones(provincePath)) 
    .map((touristzones: TouristZoneModel[]) => this.touristzoneActions.loadTouristZonesSuccess(touristzones)); 

    @Effect() getTouristZone$ = this.actions$ 
    .ofType(TouristZoneActions.GET_TOURISTZONE) 
    .map(action => action.payload) 
    .switchMap((id: string) => this.svc.getTouristZone(id)) 
    .map((tz: TouristZoneModel) => this.touristzoneActions.getTouristZoneSuccess(tz)); 

    constructor(
    private actions$: Actions, 
    private touristzoneActions: TouristZoneActions, 
    private svc: TouristZoneService) { } 
} 

Kann jemand mir erklären, warum dies passiert ist und wie lösen?

Ich lese diese: Error with Actions observable in @ngrx/effects using TypeScript 2.4.1

Aber ich verstehe nicht, wie mein Fall zu lösen.

aktualisiere ich @ NGRX/Wirkung:^2.0.3 →^4.0.1 und Typoskript^2.3.4 →^2.4.1

Dies ist die aktuelle package.json:

{ 
 
    "name": "trips", 
 
    "version": "1.0.0", 
 
    "description": "QuickStart package.json from the documentation, supplemented with testing support", 
 
    "scripts": { 
 
    "start": "tsc && concurrently \"tsc -w\" \"lite-server\" ", 
 
    "docker-build": "docker build -t ng2-quickstart .", 
 
    "docker": "npm run docker-build && docker run -it --rm -p 3000:3000 -p 3001:3001 ng2-quickstart", 
 
    "pree2e": "npm run webdriver:update", 
 
    "e2e": "tsc && concurrently \"http-server -s\" \"protractor protractor.config.js\" --kill-others --success first", 
 
    "lint": "tslint ./app/**/*.ts -t verbose", 
 
    "lite": "lite-server", 
 
    "test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"", 
 
    "test-once": "tsc && karma start karma.conf.js --single-run", 
 
    "tsc": "tsc", 
 
    "tsc:w": "tsc -w", 
 
    "webdriver:update": "webdriver-manager update" 
 
    }, 
 
    "keywords": [], 
 
    "author": "", 
 
    "licenses": [ 
 
    { 
 
     "type": "MIT", 
 
     "url": "https://github.com/angular/angular.io/blob/master/LICENSE" 
 
    } 
 
    ], 
 
    "dependencies": { 
 
    "@agm/core": "^1.0.0-beta.0", 
 
    "@angular/common": "~4.3.0", 
 
    "@angular/compiler": "~4.3.0", 
 
    "@angular/core": "~4.3.0", 
 
    "@angular/forms": "~4.3.0", 
 
    "@angular/http": "~4.3.0", 
 
    "@angular/platform-browser": "~4.3.0", 
 
    "@angular/platform-browser-dynamic": "~4.3.0", 
 
    "@angular/router": "~4.3.0", 
 
    "@angular/upgrade": "~4.3.0", 
 
    "@ngrx/core": "^1.2.0", 
 
    "@ngrx/effects": "^4.0.1", 
 
    "@ngrx/store": "^4.0.0", 
 
    "@types/lodash": "^4.14.70", 
 
    "angular-in-memory-web-api": "~0.3.2", 
 
    "angularfire2": "^4.0.0-rc.1", 
 
    "core-js": "^2.4.1", 
 
    "firebase": "^4.1.3", 
 
    "ngx-pagination": "^3.0.1", 
 
    "reflect-metadata": "^0.1.10", 
 
    "rxjs": "^5.4.2", 
 
    "systemjs": "^0.20.15", 
 
    "zone.js": "^0.8.14" 
 
    }, 
 
    "devDependencies": { 
 
    "@types/core-js": "^0.9.42", 
 
    "@types/jasmine": "^2.5.53", 
 
    "@types/node": "^8.0.14", 
 
    "@types/selenium-webdriver": "^3.0.4", 
 
    "autoprefixer": "^7.1.2", 
 
    "bootstrap": "^3.3.7", 
 
    "canonical-path": "0.0.2", 
 
    "concurrently": "^3.5.0", 
 
    "gulp": "^3.9.1", 
 
    "gulp-cssnano": "^2.1.2", 
 
    "gulp-postcss": "^7.0.0", 
 
    "gulp-rename": "^1.2.2", 
 
    "gulp-sourcemaps": "^2.6.0", 
 
    "http-server": "^0.10.0", 
 
    "jasmine-core": "~2.6.4", 
 
    "karma": "^1.7.0", 
 
    "karma-chrome-launcher": "^2.2.0", 
 
    "karma-cli": "^1.0.1", 
 
    "karma-htmlfile-reporter": "^0.3.5", 
 
    "karma-jasmine": "^1.1.0", 
 
    "karma-jasmine-html-reporter": "^0.2.2", 
 
    "lite-server": "^2.3.0", 
 
    "lodash": "^4.17.4", 
 
    "postcss-reporter": "^4.0.0", 
 
    "precss": "^2.0.0", 
 
    "protractor": "5.1.2", 
 
    "rimraf": "^2.6.1", 
 
    "stylelint": "^8.0.0", 
 
    "tslint": "^5.5.0", 
 
    "typescript": "^2.4.1", 
 
    "webdriver-manager": "12.0.6" 
 
    }, 
 
    "repository": {} 
 
}

Vielen Dank im Voraus.

+0

können Sie package.json in Frage – CharanRoot

+0

Sure sorgen !! ist aktualisiert. –

+0

@ MarcoNuñez Wenn Sie einen Mac verwenden, können Sie dies nützlich finden .. https://Stackoverflow.com/a/44350141/495157 – JGFMK

Antwort

1

Aktualisieren Sie Ihre NGRX/Effekte 2.0.4 und @ NGRX/Shop 2.2.3

"@ngrx/effects": "^2.0.4", "@ngrx/store": "^2.2.3" 

moreinfo

+0

Vielen Dank !!! Du hast den Nagel auf den Kopf getroffen. : D –

Verwandte Themen