I get this error when i do clear interval:
ERROR Error: Uncaught (in promise): TypeError: timeout.close is not a function TypeError: timeout.close is not a function at exports.clearTimeout.exports.clearInterval (main.js:14) at LiveTestGraphComponent.ngOnDestroy The set interval function:
this.inrvl = setInterval(() => loop(+new Date()), 5); And the destroy function:
ngOnDestroy(): void { if (this.inrvl) clearInterval(this.inrvl) } The component destroy with ngIf in parent component:
<test *ngIf="data.length" </test>
It's because of your IDE! Make sure your IDE didn't include automatic imports such as
import { clearInterval } from 'timers'; If so, remove them. Rest should be fine.
Had the same problem with clearTimeout.
using window.clearTimeout instead of clearTimeout works too in case you need the import { clearTimeout } from "timers"; or import { clearInterval } from 'timers'; imports.
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