思否题目不能超过 64 个无效字符 emm...
残缺题目是
《
React element implicitly has an 'any' type because expression of type 'string' can't be used to index type 告警解决
》
目前我遇到两种状况会呈现这个告警
情景一:
keyToNameMap[keyItem]
解决办法:
给keyToNameMap的key和value加上类型限度,如下图
加上 { [key: string]: string }
情景二:
同样的keyToNameMap[keyItem]
但这里的map (contentInfo)不是定义的常量。contentInfo由useState创立,受type ContentInfo限度。
解决办法:
给type ContentInfo加上类型限度,如下图
加上 [key: string]: string | number;
完结
同步更新到本人的语雀
https://www.yuque.com/diracke...