chr*_*ris 0 javascript setinterval typescript
这是我的类定义的样子:
timeLeft: Number;
constructor() {
this.timeLeft = 60;
}
start() {
console.log(typeof(this.timeLeft)); // prints out 'number'
setInterval(() => {
this.timeLeft--; // error TS2356 occurs here
console.log(this.timeLeft);
}, 1000);
}
ngOnInit() {}
Run Code Online (Sandbox Code Playgroud)
安慰:
错误 TS2356:算术操作数的类型必须为“any”、“number”或枚举类型。
| 归档时间: |
|
| 查看次数: |
633 次 |
| 最近记录: |