December 2017
Beginner
372 pages
10h 32m
English
Once TypeScript has identified the types, it uses these for type checking in the program. TypeScript checks if we try to assign a type of value to a variable that contradicts the type defined for that variable, or when a function is called, TypeScript checks if we are passing correct types for the parameters and the return value is being assigned to the correct type of variable. The only exception to this type checking is the any keyword. If a variable or property is defined with the any keyword, the TypeScript compiler does not perform type checking for that variable.
Take a look at the following example of type checking:
let age:number;age=10;age="42"; //Compile Error: string can not be assigned to a number
In the preceding ...
Read now
Unlock full access