我有以下代码
错误场景 1
@Where(['compuWarnings'], (keys: string | string[], values: unknown) => {
if (values['compuwarnings'].length === 1) {
const [creator] = values['compuwarnings'];
return {
nonUnique: {
[Op.like]: `%${creator}%`
}
};
}
当我为类型检查启用严格规则时,它在抱怨
Element implicitly has an 'any' type because expression of type '"compuWarnings"' can't be used to index type '{}'.
Property 'compuWarnings' does not exist on type '{}'.ts(7053)
当我将 values
类型设为 any
时,警告消失了,这会引发 es lint 警告。
错误场景 2
Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.
有人可以在不使用任何类型的情况下帮助解决此问题吗