Can't access object property, even though it shows up in a console log

后端 未结 30 2283
日久生厌
日久生厌 2020-11-22 06:26

Below, you can see the output from these two logs. The first clearly shows the full object with the property I\'m trying to access, but on the very next line of code, I can\

30条回答
  •  傲寒
    傲寒 (楼主)
    2020-11-22 06:56

    if you're using TYPESCRIPT and/or ANGULAR, it could be this!

    .then((res: any) => res.json())

    setting the response type to any fixed this issue for me, I couldn't access properties on the response until i set res: any

    see this question Property '_body' does not exist on type 'Response'

提交回复
热议问题