All Typescript posts
What Is the Type of NaN?
Updated on · 6 min read|NaN, or "Not a Number", is a special value in JavaScript and TypeScript (as well as many other programming languages) that represents an undefined or unrepresentable value resulting from an arithmetic operation. It is often used as a placeholder for a missing numerical value or as a way to signify an error. However, what is the type of NaN in JavaScript?
Build a Tic-Tac-Toe Game with TypeScript, React and Minimax
Updated on · 12 min read|In this tutorial we will build a Tic-Tac-Toe game with TypeScript, React, React Hooks, and style it using Styled Components library. Additionally, we'll use the Minimax algorithm to power the AI moves. The final code is available on both GitHub and CodeSandbox.
TypeScript: Typing Form Events In React
Updated on · 7 min read|Handling events in React is very close to how the events on DOM elements are handled. The biggest difference is, however, that React wraps the native DOM events into SyntheticEvent, making them behave slightly differently than the native events. Consequently, typing form events in React is not the same as native events. In this post, we'll see how to type form events in React on the example of a simple component as well as discuss the most common pitfalls.
TypeScript: Typing React UseRef Hook
Updated on · 3 min read|Typing useRef hook in TypeScript seems to be straightforward from the first glance, however there are a few issue that can make it a bit cumbersome. In this article we'll take a look at how to properly type the hook for a few most common use cases.
Simplifying Connected Props with Redux and TypeScript
Updated on · 3 min read|When using Redux-connected components there can multiple sources of props. This means a lot of manual typing and maintaining the types in the future. Luckily Redux has a solution for that.