Summary

In this chapter, we saw how TypeScript can declare variables and which declarator is be the best to use depending on the situation. We saw that TypeScript improves JavaScript's primitive type by enforcing the type during the lifetime of the variable. We explained how to transform a variable into a multiple type container with the concept of the union. TypeScript brings type to functions and we saw how we could improve the readability of a function that takes many combinations of arguments and return types with the overload function. TypeScript brings a new way to type variables with the popular enum borrowed from popular languages such as Java and C#. Finally, we glimpsed at how TypeScript is smart to infer types in different situations that can be advantageous to reduce lengthy definitions.

In the next chapter, we will see in detail the differences between many different object types and look at how we can manipulate types to have a strongly typed code flexible enough to fulfil our needs of defining our business models with TypeScript.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.13.210