All superset? TypeScript 4.3 release candidate let loose

Microsoft has unleashed TypeScript 4.3 RC, the release candidate for the next version of its programming language that builds on JavaScript.

On its developer blog, Microsoft said TypeScript 4.3 RC is effectively feature-complete. It expects no further changes apart from critical bug fixes.

Microsoft warned there are likely to be breaking changes in this release. This is especially so for declarations generated for web contexts. See here for more details.

Among the additions in TypeScript 4.3 RC is support for separate write types on properties. According to Microsoft, this addresses the issue of APIs that convert values that are passed in before storing them. This is something that can also happen with getters and setters, which read or update the property’s value respectively.


Now, TypeScript 4.3 RC allows developers to specify types for reading and writing to properties. However, Microsoft warns that a limitation of using different types for reading and writing properties is that the type for reading a property has to be assignable to the type being written. In other words, the getter type has to be assignable to the setter.

TypeScript 4.3 RC also introduces the override keyword to use when extending classes. Unintended consequences previously arose when a user couldn’t make it explicit whether they meant to add a new method or override an existing one. When a method is marked with override, TypeScript will always make sure a method with the same name exists in the base class.

More enhancements

Also added is a new –noImplicitOverride flag. It causes an error if the developer attempts to override any method from a superclass unless an override keyword has been explicitly used.

There are also template string type improvements. For example, when a template string is contextually typed by a string-literal-like type, which would mean the code is passing a template string to something that takes a literal type, TypeScript will try to give that expression a template type.

TypeScript 4.3 RC can also better infer different template string types. According to Microsoft, it will actually check whether or not each part of a template string can successfully match. This means developers can now mix and match template strings with different substitutions. TypeScript will figure out whether they are compatible.

In this release, Typescript also expands which elements in a class 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.

These are just some of the changes added in TypeScript 4.3 RC. For more, including details on getting the release candidate via NuGet, see Microsoft’s developer blog.

- Advertisement -