Element implicitly has an 'any' type because expression of type 'string' can't be used to index

后端 未结 9 1557
滥情空心
滥情空心 2020-11-27 15:42

Trying out TypeScript for a React project and I\'m stuck on this error:

Element implicitly has an \'any\' type because expression of type \'string\' can\'t b         


        
9条回答
  •  南笙
    南笙 (楼主)
    2020-11-27 16:15

    This is what it worked for me. The tsconfig.json has an option noImplicitAny that it was set to true, I just simply set it to false and now I can access properties in objects using strings.

提交回复
热议问题