
TypeScript 4 Design Patterns and Best Practices
By :

Just as there are good design patterns and best practices while using TypeScript, there are some anti-patterns as well. When working on large-scale applications, you will inevitably come across some patterns or parts that look problematic, are hard to read and change, or promote dangerous behavior. This happens because as the application grows, you will need to write more code that fits the existing code base and quite often you will have to make some compromises. Over time and as more people are contributing to the same code space, you will see many inconsistencies. In this chapter, we look at approaches to work around these problems.
In this chapter, we will gain an understanding of what happens when you overuse classes and inheritance in a system and how to avoid it. Then we will explain the dangers of not using runtime assertions in code. Afterward, we will show how permissive or incorrect types essentially ignore the type safety of your...