TypeScript is JavaScript with syntax for types. TypeScript is a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale.
React lets you build user interfaces out of individual pieces called components. Create your own React components like Thumbnail, LikeButton, and Video. Then combine them into entire screens, pages, and apps.
Solution #1
React example:
useEffect(() => {
let timer!: ReturnType<typeof setTimeout>;
timer = setTimeout(() => {
...
}, 3000);
return () => {
if (timer) {
clearTimeout(timer);
}
};
});
Solution #2
React example:
useEffect(() => {
let timer!: NodeJS.Timeout;
timer = setTimeout(() => {
...
}, 3000);
return () => {
if (timer) {
clearTimeout(timer);
}
};
});