To be able to leave your application working and forget about any troubles, you need a way to make sure that all parts of your application match each other. Languages built on top of JavaScript or ECMAScript, such as Flow or TypeScript, bring type systems to your application. Thanks to these, you will know that no one is sending the wrong data to your functions or components. We have already used PropTypes for assertions in components. Now we will apply this concept to any JavaScript variable.
In this chapter, you will learn about the following:
- The basics of type systems
- How to assign types to functions and variables
- What contract tests are; for instance, the Pact test
- Generics and union types
- Tips on how to solve type problems
- How type systems use nominal and structural typing