我正在转换一个代码库从Javascript到Typescript,并且在这个函数上有问题。我在行const valueAtKey = item[key]上收到一个输入错误,显示为Element implicitly has an 'any' type because expression ofNo index signature with a parameter of type 'string' was found on type '{}'.ts(7053)
我以为我可以通过检查T中</em
Partial泛型没有给出上下文组件的问题,但是它在todo表单组件中调用addNewTodo时给出了错误Cannot invoke an object which is possibly 'undefined同样,未定义对象{}和空对象{}也会产生不同的错误。我想不出怎么修好它。如果我通过any,那么IntelliSense就不能工作了。这里是我的代码import React, { useState, createContext,