返回一个observable认为表达式类型是OperatorFunction <r,t>

时间:2018-01-25 22:27:38

标签: angular typescript rxjs observable

我试图从像这样的简单函数中返回一个observable

public saveSurvey =(surveyId: number, surveyResponse: SurveyResponse) : Observable<Response> => {
    return this.http.post(this.config.api.survey + surveyId +'/answers', surveyResponse)
     .map((res: Response) =>  res);

};

但我的IDE(WebStorm)正在报告

Returned expression type OperatorFunction<R,T> is not assignable to type Observable<Response>

据我所知,所有示例都显示此模式工作正常,Http.get确实返回一个Observable。

0 个答案:

没有答案