Skip to Content
Modern Front-End Development for Rails
book

Modern Front-End Development for Rails

by Noel Rappin
June 2021
Intermediate to advanced
398 pages
9h 35m
English
Pragmatic Bookshelf
Content preview from Modern Front-End Development for Rails

Chapter 14Validating Code with Advanced TypeScript

Over the course of this book, we’ve been using TypeScript to make assertions about the structure of our code, which has made it easier to validate that our code is correct. Now we’re going to focus on features of TypeScript itself that we can use to enhance the typing of our system, with the goal of making it even harder to write code that puts the system in an invalid state.

Many JavaScript programs use a lot of code to protect against invalid data being passed 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 run-time checks. We can, for example, specify that a certain value can’t ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Modern Front-End Development for Rails, 2nd Edition

Modern Front-End Development for Rails, 2nd Edition

Noel Rappin
Agile Web Development with Rails 6

Agile Web Development with Rails 6

Sam Ruby, David B. Copeland, Dave Thomas

Publisher Resources

ISBN: 9781680508758Errata Page