What's New in TypeScript 2.8 RC

Microsoft is seeking developer feedback for the new TypeScript 2.8 release candidate, featuring new conditional types and more.

TypeScript was deemed a popular programming language in Stack Overflow's big developer survey and the most recent RedMonk language popularity report. It's an open source language backed by Microsoft that provides optional static typing while remaining a strict syntactical superset of JavaScript.

In highlighting the new features of TypeScript 2.8 RC, Microsoft's Daniel Rosenwasser introduced a new construct called conditional types.

"Conditional types help model simple choices made over based on types at runtime, but afford significantly more expressive constructs at design-time," Rosenwasser said. "Conditional types also provide us with a new way to infer types from the types we compare against using the new infer keyword which introduces a new type variable."

Other highlights were described by Rosenwasser thusly:

  • JSX pragmas: TypeScript now lets developers provide a pragma in order to specify the source of a JSX factory within any file.
  • Granular control on mapped type modifiers: "TypeScript 2.8 allows more explicit syntax for adding and removing modifiers in mapped types with the + and - operators." Previously, he said, mapped types could only add such modifiers if they already existed, which resulted in limitations when working with homomorphic mapped types -- copying all modifiers from the original type.
  • JSX.Element is resolved via the JSX Factory: This can shorten lookups for certain JSX types, such as a component. Where previously this lookup examined the global JSX namespace first, now the compiler will first attempt to search the JSX namespace where a JSX factory is located. "For example, if your JSX factory is React.createElement, TypeScript will try to first resolve React.JSX.Element, and then resolve JSX.Element within the current scope."

You can read more details about the above, along with some other new features, breaking changes and more in Rosenwasser's post, published yesterday (March 15).

Future changes for the language can be found in the roadmap, which includes a tweeted proposal maintaining that "TypeScript error messages should always come in haiku form."

[Click on image for larger view.] "TypeScript error messages should always come in haiku form." (source: Twitter).

Other features planned include:

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus


  • What's New in Visual Studio 2019 v16.5 Preview 2

    The second preview of Visual Studio 2019 v16.5 has arrived with improvements across the flagship IDE, including the core experience and different development areas such as C++, Python, web, mobile and so on.

  • C# Shows Strong in Tech Skills Reports

    Microsoft's C# programming language continues to show strong in tech industry skills reports, with the most recent examples coming from a skills testing company and a training company.

  • Color Shards

    Sharing Data and Splitting Components in Blazor

    ASP.NET Core Version 3.1 has at least two major changes that you'll want to take advantage of. Well, Peter thinks you will. Depending on your background, your response to one of them may be a resounding “meh.”

  • Architecture Small Graphic

    Microsoft Ships Preview SDK, Guidance for New Dual-Screen Mobile Era

    Microsoft announced a new SDK and developer guidance for dealing with the new dual-screen mobile era, ushered in by the advent of ultra-portable devices such as the Surface Duo.

  • How to Create a Machine Learning Decision Tree Classifier Using C#

    After earlier explaining how to compute disorder and split data in his exploration of machine learning decision tree classifiers, resident data scientist Dr. James McCaffrey of Microsoft Research now shows how to use the splitting and disorder code to create a working decision tree classifier.

.NET Insight

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.

Upcoming Events