Announcing TypeScript 4.4 Beta
CRANK
Today we are excited to announce the beta release of TypeScript 4.4! To get started using the beta, you can get it through NuGet, or use npm with the following command: npm install typescript@beta You can also get editor support by Downloading for Visual Studio 2019/2017 Following directions for Visual Studio Code and Sublime Text 3.
3 comments
TypeScript 4.4のcatch句の変数で、デフォルトをunknown型にできる💐
4.0からunknown型を指定することはできた(https://twitter.com/tonkotsuboy_com/status/1291579050859704324)が、省略時はany型のままだった。
4.4からは、strictフラグ(または--useUnknownInCatchVariables)によりunknown型になる😊
ラクチン🚀
TypeScript 4.4のControl Flow Analysis of Aliased Conditionsはありがたい💐
従来、type guardの値を定数に割り当てると型情報は失われていたが、TypeScript 4.4からは失われないようになる🙏
同じtype guardを複数で使用したいときに便利🥰