December 2017
Beginner
372 pages
10h 32m
English
Duck typing is the ability of a language to determine types at runtime. JavaScript follows the duck typing paradigm; it has types but they are determined dynamically and developers don't declare them. TypeScript goes one step further and adds types to the language. Having data types has been proven to increase productivity and code quality, and reduce errors at runtime. It's better to catch errors at compile time rather than have programs fail at runtime. TypeScript provides the feature of inferring types, thus allowing developers to only optionally define types. As seen in the following code, projectStatus is assigned the type number:
let projectStatus = 1;projectStatus = 'Success';// Error: Type 'Success' is not assignable to ...
Read now
Unlock full access