Paul Krill
Editor at Large

Microsoft pursues JavaScript developers with TypeScript 1.8

news
Feb 23, 20162 mins

The latest version of Microsoft's typed JavaScript superset features module augmentation, faster compilation, and control flow analysis

Microsoft has made TypeScript 1.8 available and is hoping to entice developers to migrate their JavaScript projects.

In version 1.8, .js JavaScript files now can output to .tsc, accessing the TypeScript compiler and allowing developers to convert JavaScript to TypeScript. “The TypeScript compiler checks the input .js files for syntax errors, and emits valid output based on the --target and --module flags,” the release notes state. “The output can be combined with other .ts (TypeScript) files as well.”

The upgrade also features a module augmentation capability that lets developers design more modular libraries. “This allows library authors to distribute their libraries in a piecemeal fashion,” Bowden Kelly, program manager for Visual Studio and .Net at Microsoft, said in a blog post. “Previously, TypeScript made the assumption that modules wouldn’t change. With module augmentation, users have the ability to extend existing modules such that consumers can specify if they want to import the whole module or just a subset.”

Strings in a type position become string literal types in version 1.8. “Only exact string matches are assignable to string literal types, and like any other type, they can be used in union types as well. So if we rewrite the AnimationOptions interface with string literal types, the API users now get type protection,” Kelly said.

Version 1.8 features control flow analysis to help catch common programming errors. And statements not guaranteed to execute at runtime are now flagged as unreachable code errors; unused labels are flagged as well. Stateless function components from the React JavaScript UI library now are supported in TypeScript.

Support for JSX, an embeddable XML-like syntax, has been expanded with a capability for custom JSX factories. Version 1.8 also leverages the ChakraCore JavaScript compiler, improving compilation times. 

With TypeScript, Microsoft is providing a typed superset of JavaScript that compiles to JavaScript, similar to Google’s Dart or CoffeeScript. Version 1.8 reached beta status in late January and isavailable for Visual Studio 2015 and 2013, as a NuGet package, as well as via Npm and source code.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author