搜索
您的当前位置:首页正文

error TS7053: Element implicitly has an ‘any‘ type because expression of type ‘“name“‘ can‘t be use

来源:易榕旅网
Error: src/app/app.service.ts:20:11 - error TS7053: Element implicitly has an 'any' type because expression of type '"name"' can't be used to index type 'Object'.
  Property 'name' does not exist on type 'Object'.

20       if (response['name']) {
             ~~~~~~~~~~~~~~~~


遇到上面的错误我们只需要将reponse的类型设置为any就可以了

  authenticate(credentials: {
    username: string; password: string; 

因篇幅问题不能全部显示,请点此查看更多更全内容

Top