我有一个我编写的自定义接口,以及一个使用该接口键入的变量。 我希望能够使用键字符串返回特定值来索引我的对象。为了做到这一点,我正在做var[key],但是我得到了一个打字错误。Element implicitly has an 'any' type because expression of type 'string' can't be used to index typeNo index signature with a parameter of typ
我想用方括号更新一个对象,以前我想检查是否允许更新。这是我的代码:const allowedUpdates = ['phone', 'email', 'company', ', public firstName: string, public lastName: string,
public phone: string, public em
假设要打印枚举的所有值。Object.keys(AnEnum);
console.log(AnEnum[key]);这会产生以下错误
元素隐式具有'any‘类型,因为类型'string’的表达式不能用于索引类型‘type of AnEnum’。在“type of AnEnum”类型上没有发现参数为“<e