Typescript Timer Number
It appears that in a recent updates to either type definitions in my project, or some library, that a few of my timeouts and intervals might be causing issues:
ERROR in [at-loader] ./src/pages/ExamplePage.tsx:41:23
TS2345: Argument of type '{ intervalId: Timer; }' is not assignable to parameter of type 'Pick<IState, "intervalId">'.
Types of property 'intervalId' are incompatible.
Type 'Timer' is not assignable to type 'number'.
After a little digging, I was able to find that using window.setTimout
or window.setInterval
should return the
correct type of number
– it looks like NodeJS uses Timer
.
Hope this helps!