TypeScript 4.3 released with separate write types

by Joseph K. Clark

Microsoft announced the release of typescript 4.3, which adds many new features such as different write types on properties, ‘override’ and the ‘–noImplicitOverride’ flag, template string type improvements, and more. 

With different write types, developers can specify styles for reading and writing to properties. TypeScript will only use the “reading” type when considering how two properties with the same name relate to each other. On the other hand, “writing” types are only considered when directly writing to a property.

RELATED CONTENT: TypeScript Handbook gets a rework

TypeScript logo

Microsoft also added the ‘override’ keyword in TypeScript 4.3 to overcome the issue when a user can’t make it clear whether they mean to add a new method or to override an existing one. When a plan is marked with ‘override,’ TypeScript will ensure that away with the same name exists in the base class. 

Also, the ‘noImplicitOverride’ flag becomes an error to override any method from a superclass unless one explicitly uses an ‘override’ keyword.

As part of the new template string improvements, TypeScript will now handle the work to prove whether or not each piece of a template string can successfully match so that developers can now mix template strings with different substitutions while TypeScript figures out if they’re compatible. 

TypeScript 4.3 also added methods and accessors to the elements that can be given #private #names to make them genuinely private at run-time. In the new version, the ‘ConstructorParameters’ type helper works on ‘abstract’ classes. TypeScript now includes slightly brighter type-narrowing logic on generic values, allowing it to accept more patterns. 

Other updates include always-truthy promise checks, static index signatures, .tsbuildinfo size improvements, lazier calculations in ‘–incremental’ and ‘–watch’ compilations, import statement completions, editor support for @link tags, and more.  Additional details on all of the new features in TypeScript 4.3 are available here.

Related Posts

Leave a Comment