Check out example codes for "typescript type for intervalId". It will help you in understanding the concepts better.

Code Example 1

let timer: ReturnType<typeof setTimeout> = setTimeout(() => { ... });

clearTimeout(timer);

Learn ReactJs, React Native from akashmittal.com