I am doing a simple animation in a next.js app.
let flipInterval = useRef();
const startAnimation = () => {
flipInterval.current = setInterval(() => {
setIsFlipping((prevFlipping) => !prevFlipping);
}, 10000);
};
for flipInterval.current I am getting "Type 'Timeout' is not assignable to type 'undefined'". So i checked how to use Timeout type, I see that people are using but thats not working.
let flipInterval = useRef<typeof window.settimeout>();
I also passed number useRef<number>() this time I am getting "Type 'Timeout' is not assignable to type 'number'"
this did not work neither
let flipInterval = useRef<typeof window.setInterval>();