Developers with TypeScript 1.6 get support for React typing and JSX, and TypeScript code can coexist with JSX syntax in a single file via the new .tsx extension. "This allows React developers to intermingle HTML-like syntax with TypeScript code," Turner said. The goal was to make it feel natural to work with React/JSX and have TypeScript's type-checking and autocomplete capabilities. "This allows you a rich editing experience for working with React and JSX when using Visual, Visual Studio Code, and [the Sublime text editor]. "
Version 1.6 enables developers to write class expressions as Microsoft continues to round out ES6 support, Turner said. "Similar to class declarations, class expressions allow you to create new classes. Unlike class declarations, you can use class expressions wherever you use an expression.
Object literal strictness in the upgrade is intended to make object compatibility stricter to assist in catching a common class of bugs. "This change has already helped to find dozens (if not hundreds) of real-world bugs in early adopter code, "Turner said in an earlier blog post about the beta release of TypeScript 1.6. Strict object literal assignment checking is listed as a breaking change in the release
Type capabilities are improved in version 1.6. User-defined type guard functions allow developers to work not only with typeof and instanceof checks, but also with interfaces and do custom analysis. A new type operator, "&", called intersection, creates anonymous combinations of types.
Generic alias types in 1.6 provide expressive capability, Turner explained. "Leading up to TypeScript 1.6, type aliases were restricted to being simple aliases that shortened long type names. Unfortunately, without being able to make these generic, they had limited use."
Abstract classes are featured as well. "Similar in some ways to interfaces, abstract classes give you a way of creating a base class, complete with default implementations, that you can build from with the intention of it never being used directly outside of the class hierarchy," said Turner.
Module resolution has been improved, too. "We've changed module resolution when doing CommonJS output to work more closely to how Node does module resolution," Turner said.