TypeScript-什么是f.e.setInterval [英] TypeScript - what type is f.e. setInterval
本文介绍了TypeScript-什么是f.e.setInterval的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我想为变量分配类型,该变量随后将被分配为setInterval,如下所示:
If I'd like to assign a type to a variable that will later be assigned a setInterval like so:
this.autoSaveInterval = setInterval(function(){
if(this.car.id){
this.save();
}
else{
this.create();
}
}.bind(this), 50000);
应该为this.autosaveInterval可变类型分配什么类型?
What type should be assigned to this.autosaveInterval vairable?
推荐答案
类型是数字;
private autoSaveInterval: number = setInterval( ()=>{console.log('123')},5000);
这篇关于TypeScript-什么是f.e.setInterval的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文