Back in September 2016, Microsoft released TypeScript 2.0 into general availability less than a month after the release of its corresponding Release Candidate. The extension to the JavaScript was originally introduced towards the end of 2012 and now the company has taken the wraps off the third major version of TypeScript.
In terms of headline changes between TypeScript 2.8 and 3.0, here"s what"s new:
- Project references
- --build mode
- Controlling output structure
- Extracting and spreading parameter lists with tuples
- Richer tuple types
- The unknown type
- Improved errors and UX
- Related error spans
- Improved messages and elaboration
- Support for defaultProps in JSX
- /// <reference lib="..."> directives
- Editor Productivity
- Named import refactorings​
- Closing JSX tag completions and outlining spans
- Quick fixes for unreachable code and unused labels
With any major version release, it is not unexpected for breaking changes to be introduced and that"s certainly the case for TypeScript 3.0. One obvious change is that with "unknown" becoming a new type, it is now a reserved type name and can no longer be used in type declarations. Otherwise, there"s a range of API breaking changes due to a number of functions and internal methods being deprecated or being made internal.
To get going with the latest version of TypeScript, you can issue the following command via the Node Package Manager:
npm install -g typescript
Otherwise, editor support is presently available for Visual Studio 2015 and 2017, as well as the current Insider release of Visual Studio Code and Sublime Text 3 while support for TypeScript 3 will roll out to other popular editors over time.
Microsoft has invited the submission of ideas and feedback from contributors, TypeScript authors, and members of the JavaScript community via Twitter or filing an issue via GitHub. Otherwise, the company has provided an indication of what"s to come in TypeScript 3.1 and beyond, courtesy of its published roadmap.