Menu
TypeScript 4.3 supports type specification for properties

TypeScript 4.3 supports type specification for properties

Now available in beta, the upgrade to Microsoft’s typed JavaScript also introduces an override keyword and improvements to template string types.

Credit: Dreamstime

TypeScript 4.3, a planned upgrade to Microsoft’s typed superset of JavaScript, allows developers to specify types for reading and writing to properties.

This type specification enhancement addresses a situation in which modeling APIs that convert values in TypeScript has required picking between “being precise” and “being permissive.” By being precise, developers could make reading values easier but writing them harder. By being permissive, they could make writing values easier but reading harder.

TypeScript 4.3 is available in beta release as of April 1. A release candidate is due on  May 11, and the production release on May 25.

Other features planned in TypeScript 4.3 include the addition of an override keyword, whereby a method marked with this keyword will make sure that a method with the same name exists. When extending classes in JavaScript, the language makes it easy to override methods, but there are mistakes that can be made, such as missing renames. A noImplicitOverride flag makes it an error to override any method from a superclass unless the developer explicitly uses the override keyword.

Improvements to template string types are also in the works, including better relating and inferring between different template string types. TypeScript now does the work to prove whether or not each part of a template string can successfully match.

Meanwhile, more class elements can be given #private#names to make them truly private at runtime. In addition to properties, now methods and accessors can be given private names, as can static members. Under strictNullChecks, an error will be triggered when checking whether a Promise is “truthy” in a conditional.

Delving deeper, index signatures, which allow developers to set more properties on a value than a type explicitly declares, now can be declared as static. Previously, they could only be declared on the instance side of a class.

When an import statement does not have a path, a list of possible imports will be provided. When developers commit a full completion, the full import statement will be completed including the path that was going to be written. TypeScript now can understand @Link tags and will try to resolve declarations they link to.

TypeScript 4.3 can be accessed through NuGet or via NPM using the command npm install typescript@beta. TypeScript 4.2 was published as a production release on February 23, featuring enhancements pertaining to tuple types and type aliases.


Follow Us

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Tags Microsoft

Events

Why experience is the new battleground for partners

Join us for an exclusive webinar, in association with Hewlett Packard Enterprise and Technology Services Industry Association (TSIA) and learn about the latest industry insights and how technology services continue to evolve to deliver differentiated value, and how partners can be successful in 2021 and beyond.

Featured

Slideshows

The Kiwi channel gathers for the 2020 Reseller News Women in ICT Awards

The Kiwi channel gathers for the 2020 Reseller News Women in ICT Awards

Hundreds of leaders from the New Zealand IT industry gathered at the Hilton in Auckland on 17 November to celebrate the finest female talent in the Kiwi channel and recognise the winners of the Reseller News Women in ICT Awards (WIICTA) 2020.

The Kiwi channel gathers for the 2020 Reseller News Women in ICT Awards
Leading female front runners honoured at the 2020 Reseller News Women in ICT Awards

Leading female front runners honoured at the 2020 Reseller News Women in ICT Awards

The leading female front runners of the New Zealand ICT industry joined together for the annual Reseller News Women in ICT Awards event at the Hilton in Auckland, during which hundreds of guests celebrated 13 outstanding individuals who won awards, chosen from more than 50 finalists representing over 30 organisations.

Leading female front runners honoured at the 2020 Reseller News Women in ICT Awards
Channel gathers to celebrate the Reseller News Innovation Awards 2020 winners

Channel gathers to celebrate the Reseller News Innovation Awards 2020 winners

More than 500 channel leaders gathered in Auckland on 21 October at the ​Reseller News Innovation Awards ​2020 to celebrate the achievements of the New Zealand technology industry's top partners, start-ups, vendors, distributors and individuals.

Channel gathers to celebrate the Reseller News Innovation Awards 2020 winners
Show Comments