What's New in TypeScript 3.0 Release Candidate

Microsoft's TypeScript team just shipped the release candidate for the new TypeScript 3.0 -- scheduled for final release later this month -- incorporating many new features dealing with project references, a new unknown type and more.

The open source programming language is primarily developed and maintained by Microsoft, providing a strict syntactical superset of JavaScript with the addition of optional static typing.

Along the way to TypeScript 3.0, the dev team has added conditional types in v2.8 and code editor functionality in v2.9.

In the new TypeScript 3.0 RC, announced today (July 12), the team highlighted improved project reference functionality, using tuples to extract and spread parameter lists -- which also required richer tuple types -- a new unknown type and support for defaultProps, a React.js construct.

The project reference improvements aim make it easier to work with TypeScript projects that depend on other projects. By specifying dependencies in the tsconfig.json file, developers can more easily split their code into smaller projects and rest assured of the correct build ordering and output structure. "That means things like faster builds that work incrementally, and support for transparently navigating, editing, and refactoring across projects," the team said in a post. "Since 3.0 lays the foundation and exposes the APIs, any build tool should be able to provide this."

New functionality for extracting and spreading parameter lists with tuples, meanwhile, means much less overloading to account for functions of varying parameter lengths. Previously, different overloads had to be written out to support functions with different numbers of parameters -- one for each length.

"TypeScript 3.0 allows us to better model scenarios like these by now allowing rest parameters to be generic, and inferring those generics as tuple types," the team said.

That functionality, in turn, demanded richer tuple types to model scenarios such as optional parameters at the end of a parameter list, a final parameter that can be a rest parameter and empty parameter lists.

The new unknown type is like the existing any type, but it can accommodate APIs that use a variable of any value but require type checking.

"Much like any, any value is assignable to unknown; however, unlike any, you cannot access any properties on values with the type unknown, nor can you call/construct them. Furthermore, values of type unknown can only be assigned to unknown or any," the post said.

Finally, Microsoft highlighted support for the JSX defaultProps used in React. React's defaultProps let developers define default values for props in the creation of a component, such as a source for an Image component. TypeScript 3.0 "supports a new type alias in the JSX namespace called LibraryManagedAttributes. Despite the long name, this is just a helper type that tells TypeScript what attributes a JSX tag accepts. The short story is that using this general type, we can model React's specific behavior for things like defaultProps and, to some extent, propTypes."

According to the TypeScript roadmap, TypeScript 3.0 is scheduled to be released in its final form this month.

"We're looking to get any and all feedback from this RC to successfully ship TypeScript 3.0 proper, so if you'd like to give it a shot now, you can get the RC through NuGet, or use npm," the dev team said.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus


  • Vendors Update Controls for .NET Core 3.1, Blazor

    This week saw two third-party vendors of dev tools -- UX and UI toolkits and controls -- release new offerings that include support for two of Microsoft's main open source frameworks, the cross-platform .NET Core 3.1 and Blazor, which allows for creating browser-based web applications with C# instead of JavaScript.

  • C++ Is Focus of New Visual Studio 2019 v16.7 Preview 2

    C++ development is a focus point of the new Visual Studio 2019 v16.7 Preview 2, featuring a slew of tweaks and improvements touching upon remote SSH connections, IntelliSense support and more.

  • Clustering Non-Numeric Data Using C#

    Clustering non-numeric -- or categorial -- data is surprisingly difficult, but it's explained here by resident data scientist Dr. James McCaffrey of Microsoft Research, who provides all the code you need for a complete system using an algorithm based on a metric called category utility (CU), a measure how much information you gain by clustering.

  • So What's Up with Microsoft's (and Everyone Else's) Love of Rust?

    Microsoft already stewards several popular programming languages -- C#, TypeScript, F# -- so what's up with its love of Rust, along with the rest of the world?

  • C# Steps Up Programming Language Popularity Ladder

    Microsoft's C# programming language climbed a year-over-year notch on the TIOBE Index, which measures popularity among developers.

.NET Insight

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.

Upcoming Events