Latest video
Latest posts

Fix type X is not assignable to type Y

Best Practices

The error message that undefined cannot be assigned to a specific type often occurs when working with optional parameters. When a parameter is marked as optional, it can either be undefined or of the specified type. In TypeScript this is represented by a union type such as undefined | string. If you want to use a function that doesn’t accept undefined as a parameter (e.g., parseInt), you must first validate that your value exists.

Here are some helpful tricks for accomplishing this.

Continue reading →

Improve your switch cases with TypeScript

Best Practices

In this tutorial Benny shows you simple techniques on how to improve your switch statements. Using the tips and tricks from the video, you will never miss a switch case again. You will also learn how to fix error TS2322, TS2366 and TS7030.

Continue reading →