TypeScript already had the ability to check whether a variable had a more specific type, and the type-checker uses control flow analysis to deduce the type within every language construct. However, until now, if you chose to store the condition in a constant, as inconst argIsString = typeof arg === “string”;
then TypeScript couldn’t use that condition in a type guard check. It does now. This beta also received support for symbol and template string pattern index signatures. This means developers can use such objects as dictionary-like types, with string keys to index into them with square brackets.
Some major highlights of TypeScript 4.4 are:
- Control Flow Analysis of Aliased Conditions
- Symbol and Template String Pattern Index Signatures
- Defaulting to the
unknownType in Catch Variables (
- Exact Optional Property Types (
tsc --helpUpdates and Improvements
- Performance Improvements
- Inlay Hints
- Breaking Changes
TypeScript can be installed through three installation routes depending on how you intend to use it: an npm module, a NuGet package or a Visual Studio Extension, find out more on your suitable download.