Property 'json' does not exist on type '{}'

前端 未结 2 1783
清歌不尽
清歌不尽 2020-12-15 19:01

I have an abstract base class in Typescript that looks like this:

import {Http, Headers, Response} from \'angular2/http\'; 
export abstract class SomeService         


        
2条回答
  •  春和景丽
    2020-12-15 19:26

    To me this looks strange...

    .map(res => (res).json())
    

    I would do

    .map((res: Response) => res.json())
    

提交回复
热议问题