Search code examples
javascriptangulartypescript

Typescript Error: setInterval - Type 'Timer' is not assignable to type 'number'


I have the following code:

let onSizeChangeSetInterval = setInterval(() => {...}, 30);

When I compile this code, I'm getting the following error:

ERROR in src/components/popover/popover.component.ts(98,17): error TS2322: Type 'Timer' is not assignable to type 'number'. src/modules/forms-ui/formly/types/daterange/picker.daterange.component.ts(186,9): error TS2322: Type 'Timer' is not assignable to type 'number'.


Solution

  • Use window.setInterval instead