Microsoft has announced the availability of the latest version of TypeScript. TypeScript 3.8 introduces several new features, including new ECMAScript standards features and new syntax for type-only imports and exports.
One of the new ECMAScript features is private fields. Rules of private fields include that they start with a “#” character, every private field name is uniquely scopes, accessibility modifiers can’t be used on them, and they can’t be accessed or detected from outside of the containing class. In addition to privacy, a benefit of private fields is that they are unique, which means they can’t be overwritten in subclasses.
Other new features include export * as ns syntax, top-level await, JSDoc property modifiers, better directory watching on Linux, “fast and loose” incremental checking, and more.
This release also introduces features specific to the editor. It now offers the ability to convert string concatenations into template strings. It also introduces call hierarchy, which allows developers to visualize the ways a function will be called.
In addition, TypeScript 3.8 introduces some breaking changes that developers should be aware of. It now has stricter type-checking, optional arguments with no inferences are now marked as “any,” and now objects in JSDoc will not be marked “any” under “noImplicityAny.”
Microsoft anticipates that TypeScript 3.9 will be released in mid-May 2020. The upcoming release with focus on performance, polish, and smarter type-checking. More information is available here.