Microsoft releases TypeScript 1.6 tool for Visual Studio 2015

Reading time icon 3 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more

Microsoft has announced the release of TypeScript 1.6. For those unfamiliar with TypeScript, it is a programming language developed by Microsoft as a superset of the prolific web development language JavaScript. JavaScript powers the dynamic functionality behind every modern website on the internet, alongside HTML and CSS, which handle layout and display. TypeScript was developed to compensate for one of JavaScript’s most prominent criticisms: its lack of a type-safety and static, compile-time safeguards, which makes it cumbersome to use in large scale projects. As a superset of JavaScript, all JavaScript code is valid TypeScript code, which makes its integration with currently existing JavaScript code bases a breeze.
TypeScript 1.6 can be downloaded through Visual Studio 2015, Visual Studio 2013, on npm, or as source.
The most prominent new feature of the new 1.6 version is React/JSX support.

Designed with feedback from React experts and the React team, we’ve built full-featured support for React typing and the JSX support in React.  Below, you can see TypeScript code happily coexisting with JSX syntax within a single file with the new .tsx extension. This allows React developers to intermingle HTML-like syntax with TypeScript code.
Our goal was to make it feel natural to work with React/JSX and to have all the type-checking and autocomplete capabilities of TypeScript.  This allows you a rich editing experience for working with React and JSX when using VS, VS Code, and Sublime.
 

2500.6177.Renaming.gif-550x0
Next up is Class Expressions, which allows developers to declare classes as though they were normal expressions. A notable use-case for this would be defining and extending anonymous classes, much in the same way Javascript allows the declaration of anonymous functions.
TypeScript 1.6 also adds the ability to create user-defined type guards. In addition to standard type-checking using if statement comparisons, guard functions are succinctly declared with a return value of “value is Type”, which returns a boolean that can work with instanceof and typeof comparison checks and better facilitates compile-time checking of dynamic types.
Up next is intersection types, which creates a very convenient shorthand for combining two different types via the new & operator, obviating the need to create clunky interfaces that inherited from other types.
A hotly demanded feature that has finally been incorporated is abstract classes. Abstract classes function similar to interfaces, but have the added option of describing implementation details meant to be consumed directly by their inheritors.
Another popular feature implemented is generic type aliases, which supplants the previous limitation of only allowing simple aliases that shortened long type names. Type aliases can now be generic, granting them full expressive capabilities.
No update this big comes without the possibility of breaking compatibility with older versions. In an effort to better facilitate the objectives of TypeScript, TypeScript 1.6 now requires object literals to be matched more closely. Failure to do so will elicit compile time errors. According to the beta, this has already mitigated hundreds of potential bugs and errors. Look here for a more comprehensive examination of potentially breaking scenarios.
Finally, the TypeScript team is working on a set of improvements to module resolution. This is currently a work in progress, and the team welcomes all community feedback to help in figuring it out.
It should be stressed that the development of TypeScript is incredibly transparent and open: virtually all of TypeScripts feature implementations have been the result of exhaustive discussion between the TypeScript team and members of the developer community.
So, if you’re interested in improving TypeScript to work better for you, head on over to the language’s website and send them your thoughts.
 

User forum

0 messages