I want to use the type NodeJS.Timer
as a type annotation in one of my classes:
const interval: NodeJS.Timer = setInterval(this._func, 1000)
How can I import this type? I am using flow.
Flow uses the IntervalID
type as the return type from the setInterval
/setTimeout
functions. You can see the function typedef here in the core defs.
To use it, just type interval
with that type:
const interval: IntervalID = setInterval(this._func, 1000)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With