TypeScript 定时器类型异常 不能将类型“Timeout”分配给类型“number” Type 'Timeout' is not assignable to type 'number'.
问题
不能将类型“Timeout”分配给类型“number”
Type 'Timeout' is not assignable to type 'number'.
解决方案
设置类型为NodeJS.Timeout
清除时使用delete ref.timer + clearTimeout
export type TimerType = NodeJS.Timeout
current.timer = setTimeout(() => {
delete current.timer
},timeout)