rendered]
ERROR in ng:///home/x/y/z.html (10,6): Operator '==' cannot be applied to types 'string' and 'number=' cannot be applied to types 'string' and 'number'.ERROR in ng:///home/
let i: number = 2;
console.log(i);错误:运算符!=不能应用于类型2和4。但是它们是“类型”数字,不是吗?顺便说一句。这是与==操作符一起工作的,但是它不能处理!=和==运算符的混合操作。
您可以在这里使用上面的代码再现它:。我可能会添加,当我在变量前面手动添加< number>时,或者当我声
我试过检查一下 const returnedValue = helperFunction(obj.blah) //this could be a number or string return returnedValue+ anotherValue; return ‘-’;
我以为Number.isNaN会消除错误