News

TypeScript 3.0 release candidate is here

2 min read

After the announcement of Typescript 2.9 RC  back in May, Microsoft’s TypeScript team came out with the release candidate of TypeScript 3.0 last week, unveiling features such as project references, extracting and spreading parameter lists with tuples, a new unknown type and API breaking changes among others.

Let’s discuss the highlights of TypeScript 3.0 RC release.

Project Reference functionality

It allows TypeScript projects to depend on other TypeScript projects. Once these dependencies have been specified in the tsconfig.json file, you can easily split your code into smaller projects. It also provides TypeScript (and tools around it) a way to understand build ordering and output structure.

Extracting and spreading parameter lists using tuples

This functionality helps with reducing the overloading amount for functions of varied parameter lengths. Also, there is no need to write different overloads to support functions with different number of parameters.

TypeScript 3.0 allows to better model scenarios like these by allowing rest parameters to be generic, and concluding those generics as tuple types. This, in turn, demands for richer tuple types to model scenarios such as optional parameters at the end of a parameter list, a final parameter which can be a rest parameter along with empty parameter lists.

A new ‘unknown’ type

Apart from these features, the new unknown type feature can accommodate APIs that uses variable of any value but requires type checking.

Support for the JSX defaultProps

There is also support for the JSX defaultProps used in React. These defaultProps allow the developers to define default values for props during creation of a component, such as a source for an Image component.

TypeScript 3.0 RC also supports a new type alias called LibraryManagedAttributes in the JSX namespace. LibraryManagedAttributes is just a helper type that tells TypeScript what attributes a JSX tag accepts. Using this general type helps model React’s specific behavior for things such as defaultProps and propTypes.

Apart from these features, there are API breaking changes

API Breaking Changes

  • The internal method LanguageService#getSourceFile is removed, after being deprecated for two years.
  • The function TypeChecker#getSymbolDisplayBuilder and its associated interfaces are removed.
  • The deprecated functions escapeIdentifier and unescapeIdentifier are removed.

TypeScript 3.0 release is scheduled for sometime later this month.

For more information on the latest TypeScript 3.0 RC release, check out the official Microsoft Blog.

Read Next

How to work with classes in Typescript

How to install and configure TypeScript

 

Natasha Mathur

Tech writer at the Packt Hub. Dreamer, book nerd, lover of scented candles, karaoke, and Gilmore Girls.

Share
Published by
Natasha Mathur
Tags: TypeScript

Recent Posts

Top life hacks for prepping for your IT certification exam

I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…

3 years ago

Learn Transformers for Natural Language Processing with Denis Rothman

Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…

3 years ago

Learning Essential Linux Commands for Navigating the Shell Effectively

Once we learn how to deploy an Ubuntu server, how to manage users, and how…

3 years ago

Clean Coding in Python with Mariano Anaya

Key-takeaways:   Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…

3 years ago

Exploring Forms in Angular – types, benefits and differences   

While developing a web application, or setting dynamic pages and meta tags we need to deal with…

3 years ago

Gain Practical Expertise with the Latest Edition of Software Architecture with C# 9 and .NET 5

Software architecture is one of the most discussed topics in the software industry today, and…

3 years ago