以以下代码段为例:
getClaims
如您所见,此类中的变量class A {
private foo : number = 3;
public method () {
if (this.foo === 3) {
this.anotherMethod();
if (this.foo === 4) {
console.log(this.foo);
}
}
}
public anotherMethod () {
this.foo = 4;
}
}
通过方法foo
进行了更改。假设变量始终为“ 3”。但是Typescript对此并不“同意”。它继续显示错误:
anotherMethod
我如何关闭它?