intervalle clair e.close n'est pas une fonction

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.
Defeated Dingo