What’s new in TypeScript 2.6 ?
Version 2.6 of Microsoft’s TypeScript language has been changed to Release Candidate. This new version comes with more rigor in the audit to help developers better detect errors. The language introduces a strict check flag that is introduced by –strictFunctionTypes. The TypeScript language program manager explains that in strict verification any function that does not come from a method has its parameters compared “contravariantly”.
Typically, TypeScript compared the parameters in a “bivariant” way, which brings benefits such as a simpler model for working with arrays. TypeScript 2.6 has found a compromise by increasing the rigor on all types of functions except methods while allowing modeling of use cases such as event handlers and simplified table management.
To override type checks in existing code, some large organizations update project dependencies in tandem. As a result, any code changes that introduce a type verification error will require a fix to avoid breaking the code generation job. According to Rosenwasser, “Even though error detection is useful, the reality is often that the code continues to work and that development teams have limited resources. Microsoft recommends that you use the delete comments sparingly and always provide an explanation to help understanding.
Support improvements are planned for tools such as Visual Studio and Visual Studo Code with this release. Version 2.6 of the language allows developers to refactor comments in the JSDoc documentation into TypeScript annotations. Organizational changes have been made to the DOM declarations in lib.d.ts. TypeScript 2.6 can be installed via NPM by running the command npm install -g typecript @ rc or via NuGet. It can also be installed via Visual Studio 2017.