|TypeScript 4.3 Adds Separate Property Write Types|
|Written by Kay Ewbank|
|Tuesday, 15 June 2021|
TypeScript 4.3 has been released with enhancements including separate write types on properties, template string type improvements, and #private support for EMCAScript class elements.
Template string types, which were added recently to TypeScript to provide types that construct new string-like types by concatenating or by matching the patterns of other string-like types, have also received work in this release. The improvements start by changing when TypeScript will infer a template string type. In the new release, when TypeScript sees that you're passing a template string to something that takes a literal type, it will try to give that expression a template type. Another change means that TypeScript is better at relating to and inferring between different template string types.
A third improvement is that TypeScript 4.3 expands which ECMAScript class elements elements can be given #private #names to make them truly private at run-time. In addition to properties, methods and accessors can also be given private names.
Other improvements include changes to the ConstructorParameters type helper so it now works on abstract classes, and smarter type-narrowing logic on generic values. This allows TypeScript to accept more patterns, and sometimes even catch mistakes.
TypeScript 4.3 is available now.
or email your comment to: firstname.lastname@example.org