New TypeScript operator finds coding mistakes

Microsoft’s TypeScript 4.9, a planned upgrade to the well-known, strongly typed language that builds on JavaScript, has attained the release candidate stage. The update attributes a satisfies operator that can capture problems.

With satisfies, developers can validate that the type of an expression matches some form, without having modifying the ensuing kind of the expression. This operator can be applied to catch achievable problems, this kind of as making sure that an item has all the keys of some kind, but no much more than that.

Also in TypeScript 4.9, the in operator has been designed additional powerful when narrowing styles that do not listing the home. Alternatively of leaving them as is, the language will intersect their kinds with Document<”property-key-being-checked”, unknown>.

Launched November 1, subsequent a September 23 beta, the TypeScript 4.9 RC can be downloaded through NuGet or through NPM using the adhering to command:

npm 
Read more