Tuesday, 30 January, 2024 UTC


Summary

TypeScript 5.4, a planned update to the strongly typed JavaScript variant from Microsoft, has reached beta availability. New capabilities include preserved narrowing within function closures created after the last assignment and a NoInfer type to block inferences to valid but unwanted types.
Released January 29, TypeScript 5.4 can be accessed via NuGet or NPM. In NPM, use the following command:
npm install -D typescript@beta
TypeScript 5.4 makes narrowing smarter. Detailing the improvement, Microsoft said a common pain point in TypeScript was that narrowed types were not always preserved within function closures. In TypeScript 5.4, when parameters and let variables are used in non-hoisted functions, the type checker will look for a last assignment point. If one is found, TypeScript can narrow from outside the containing function.
To read this article in full, please click here