...

/

Introduction to Validating Code with Advanced TypeScript

Introduction to Validating Code with Advanced TypeScript

Let’s dig deeper and have a look at some more advanced features of TypeScript.

We'll cover the following...

Features of TypeScript

Throughout this course, we’ve been using TypeScript to make assertions about the structure of our code, which has made it easier to validate our code. Now we’re going to focus on features of TypeScript itself that we can use to enhance the typing of our system to make it even harder to introduce errors that put the system in an invalid state.

Many JavaScript programs use a lot of code to protect against passing invalid data around, continually performing null checks or other type checks. We can use our TypeScript system to make certain kinds of invalid states impossible without using runtime checks. We can, for example, specify that a certain value can’t be set to ...