Introduction to Strongly Typed Code
Explore the concept of strongly typed code using TypeScript within Angular and NgRx. Learn how defining explicit data types enhances error detection during development, ensuring your application handles data correctly and functions as expected in production.
We'll cover the following...
We'll cover the following...
What is strongly typed code?
Strongly typed code is a programming technique that clearly defines variables and their data types. In other words, the values of the variables must be consistent with their specified data type. Let’s consider two examples of strongly and weakly typed code:
Example of weakly typed code
In the example above, we have both loosely typed JavaScript and strongly typed TypeScript code of the same function sum(). The only difference between the two code snippets is the type declarations in the TypeScript ...