The type 'void' can not be assigned to the type 'ObservableInput Action'

0

I am receiving the following typing error when I try to dispatch an observable of actions in my effect:

 @Effect()
    rideSummary$: Observable<Action> = this.actions$.pipe(
        ofType<GetRideSummary>(RideActionTypes.GetRideSummary),
        map(action => action.payload),
        switchMap(payload => {
            const { ride, passenger } = payload;
            const allPassengers = [...ride.passengers, passenger];
            this.store.dispatch(new SetLoading);
            this.directionService.computeRideRouteSummary(ride, allPassengers)
            .then((summary: RideRouteSummary) => {
                const updatedRoute = Geometry.newFromData({
                    type: Geometry.LINE_STRING,
                    coordinates: summary.route
                });

                const totalTime = summary.totalTime;
                const arrivalTime = ride.type === Ride.TYPE_TOWORK ?
                    ride.hour :
                    ride.hour + summary.totalTime;
                const departureTime = ride.type === Ride.TYPE_TOWORK ?
                    ride.hour - summary.totalTime :
                    ride.hour;
               this.store.dispatch(new UnsetLoading);
               return this.store.dispatch(new GetRideSummarySuccess({
                    updatedRoute,
                    totalTime,
                    arrivalTime,
                    departureTime
                }));
                }
            ).catch(error => {
                this.store.dispatch(new UnsetLoading);
                catchError(() => of(new HandleError(error)));
            });
        })
    );

The error says:

  

Unable to assign an argument of type "(payload: {ride: Ride; passenger: Passenger;}) => void" to the type parameter "(value: {ride: Ride; passenger: Passenger;}, index: number) = > ObservableInput ".     The type 'void' can not be assigned to the type 'ObservableInput'.

I'm not sure what the problem is. It seems to be related to the promise. Any help?

    
asked by Cesar Jr Rodriguez 19.10.2018 в 22:22
source

0 answers