Microsoft has announced the general availability of TypeScript 4.4.
This latest release introduces control flow analysis for aliased conditions and discriminants, which checks to see if a type guard has been used before a particular piece of code.
Another new feature is index signatures for symbol and template string patterns. Index signatures are used to describe objects that have properties which must use a certain type, but until now they could only be used on string and number keys.
Another new flag being introduced in TypeScript 4.4 is ‘–exactOptionalPropertyTypes,’ which specifies that property types be interpreted as written. According to Microsoft, this flag is not part of the –strict family and must be turned on if a developer wants to make use of it.
TypeScript 4.4 also added support for static blocks in classes, which is an upcoming ECMAScript feature. Static blocks can be used to write a sequence of statements with their own scope that are able to access private fields within a containing class. This allows developers to write more complex initialization code with the capabilities of writing statements, full access to a class’ internals, and not have to worry about leakage of variables.
The ‘–help’ option has also been updated in this release with changes to descriptions of compiler options and updated colors and other visual separation.
More information about the release is available here.