April 2018
Beginner
536 pages
13h 21m
English
The TypeScript type system allows us to cast a given type using two different syntaxes:
var myObject: TypeA;var otherObject: any;myObject = <TypeA> otherObject; // Using <>myObject = otherObject as TypeA; // Using as keyword
It is important to understand that the TypeScript casting does not affect the runtime type of the variables.
In general, it is recommended to avoid using type castings and prefer generic types instead.