- 23 September, 2016 03:14
Key improvements in TypeScript 2.0 include simplified declaration file acquisition, in which declarations for a library are made easier, and non-nullable types, in which null and undefined have their own types for developers to express when null/undefined values are acceptable. "Because this is a breaking change, we've added a
--strictNullChecks mode to opt into this behavior. However, going forward it will be a general best practice to turn this flag on as it will help catch a wide range of null/undefined errors."
Control flow analyzed types in version 2.0 can produce the most specific type possible. "When combined with non-nullable types, TypeScript can now do much more complex checks, like definite assignment analysis." Also, immutable programming has been made easier in version 2.0 by declaring properties read-only.