从服务器http帖子获取响应时显示错误

时间:2018-07-26 15:35:50

标签: angular typescript http observable

我有一个名为GraphResponse的类,该类基本上包含一个地图>。我正在编写此方法,以从服务器获取响应作为此类对象。

    public getGraph(graphRequest: graphRequest): Observable<graphResponse> {
            return this._http.post(this._graphUrl, JSON.stringify(graphRequest, this.options)
            .map(resp => resp.json() as graphResponse);
}

GraphResponse类是这样的:

   import { Node } from './graph/node';
   import { Edge } from './graph/edge';

   export class OrchestrationGraphResponse {
    nodeListMap: Map<Node,Array<Edge>>;
  }

但这显示了此错误:

  Type 'Observable<Response>' is not assignable to type 'Observable<GraphResponse>'.
      Type 'Response' is not assignable to type 'GraphResponse'.
        Property 'nodeListMap' is missing in type 'Response'.

我该如何处理?

0 个答案:

没有答案