TypeScript 3.6 Now Feature-Complete, Release Candidate Next
Microsoft's open source TypeScript programming language, fresh off cracking the top 10 in a popularity index for the first time, is out in a v3.6 beta that is feature complete, with the release candidate coming next.
TypeScript 3.6 is expected to be released near the end of next month, with a release candidate coming soon on the heels of the July 19 beta, described by program manager Daniel Rosenwasser as feature complete.
The TypeScript roadmap includes the following items for TypeScript 3.6:
Here's a summary of Rosenwasser's descriptions of some of the main new features in the TypeScript 3.6 beta:
- Stricter Generators: "TypeScript 3.6 introduces stricter checking for iterators and generator functions. In earlier versions, users of generators had no way to differentiate whether a value was yielded or returned from a generator."
- More Accurate Array Spread: This in response to a pull request titled "Add __spreadArrays helper," stating "Adds a __spreadArrays helper for a more accurate spread behavior when not using --downlevelIteration."
Rosenwasser explained: "In pre-ES2015 targets, the most faithful emit for constructs like for/of loops and array spreads can be a bit heavy. For this reason, TypeScript uses a simpler emit by default that only supports array types, and supports iterating on other types using the --downlevelIteration flag. Under this flag, the emitted code is more accurate, but is much larger.
"TypeScript 3.6 introduces a new __spreadArrays helper to accurately model what happens in ECMAScript 2015 in older targets outside of --downlevelIteration."
- Improved UX Around Promises: "Promises are one of the most common ways to work with asynchronous data nowadays. Unfortunately, using a Promise-oriented API can often be confusing for users. TypeScript 3.6 introduces some improvements for when Promises are mis-handled.
"For example, it's often very common to forget to .then() or await the contents of a Promise before passing it to another function. TypeScript's error messages are now specialized, and inform the user that perhaps they should consider using the await keyword."
- Semicolon-Aware Code Edits: "Editors like Visual Studio and Visual Studio Code can do automatically apply quick fixes, refactorings, and other transformations like automatically importing values from other modules. These transformations are powered by TypeScript, and older versions of TypeScript unconditionally added semicolons to the end of every statement; unfortunately, this disagreed with many users' style guidelines, and many users were displeased with the editor inserting semicolons.
"TypeScript is now smart enough to detect whether your file uses semicolons when applying these sorts of edits. If your file generally lacks semicolons, TypeScript won't add one."
In addition to providing code samples and other information for the above, Rosenwasser's post lists several breaking changes affecting DOM updates, constructor naming and the consultation of immediately preceding JSDoc comments to figure out declared types.
The roadmap shows future plans including:
Developers have been clamoring for the poetic presentation of error messages (in haiku or iambic pentameter) for about a year and a half, but Rosenwasser didn't mention that much-discussed PR in his latest post.
David Ramel is the editor of Visual Studio Magazine.