News

Microsoft Ships 'Next-Gen' TypeScript 4.0 Milestone

TypeScript hit the v4.0 milestone, featuring a bevy of new features, improvements and fixes as the latest edition of Microsoft's popular open source programming language was said to represent the "next generation" of releases focusing more on expressivity, productivity and scalability.

A company spokesperson told Visual Studio Magazine that the new release revolves around these themes:

  • Improving the experience of using TypeScript
  • Enhancing performance and scalability
  • Expanding the entry-level experience with JavaScript/TypeScript

Because the new release features "no major breaking changes," program manager Daniel Rosenwasser said now was the best time for newbies to get onboard with TypeScript, which clocked in at No. 2 on the list of "most loved" programming languages in a recent Stack Overflow survey. Speaking to that love, Rosenwasser noted that in July the language for the first time hit 50 million downloads in a month via the npm JavaScript package manager.

The New TypeScript Web Site
[Click on image for larger view.] The New TypeScript Web Site (source: Microsoft).

Along with new features, Rosenwasser mentioned the new web site for the language, which Microsoft earlier said was "built out of a desire to make the documentation for TypeScript feel as expansive as its type-system, with a design that fits modern Microsoft styles."

Highlights of the new site include:

  • New navigation
  • Playground version 3
  • Improved documentation
  • TSConfig Updates
  • Accessibility improvements
  • Localization enhancements

As far as new features and improvements, those are mostly the same as the TypeScript 4.0 beta released in June, when we detailed:

  • Variadic Tuple Types: Spreads in tuple type syntax can now be generic, and spread elements can occur anywhere in a tuple -- not just at the end.
  • Labeled Tuple Elements: Tuples types can now provide labels, and the syntax for rest elements and optional elements now mirror that of parameter lists.
  • Class Property Inference from Constructors: TypeScript 4.0 can now use control flow analysis to determine the types of properties in classes when noImplicitAny is enabled.
  • Short-Circuiting Assignment Operators: TypeScript 4.0 supports a promising proposal to add three new assignment operators: &&=, ||=, and ??=. These fill out the list of JavaScript operators that have corresponding operating assignment operators, which let developers apply an operator to two arguments and then assign the result to the left side.
  • unknown on catch Clauses: Developers can now specify the type of catch clause variables as unknown instead of the default any, which caused some undesirable behavior in certain situations.
  • Custom JSX Factories: Coders can now customize the fragment factory through the new jsxFragmentFactory option. Fragments are a type of JSX element that allows for returning multiple child elements.
  • Speed Improvements in build mode with --noEmitOnError: TypeScript 4.0 changes gives a great speed boost in scenarios such as when compiling a program after a previous compile with errors under --incremental, which would be extremely slow when using the --noEmitOnError flag.
  • --incremental with --noEmit: TypeScript 4.0 allows developers to use the --noEmit flag while still leveraging --incremental compiles. This was previously not allowed, because --incremental needs to emit a .tsbuildinfo files; however, the use-case to enable faster incremental builds is important enough to enable for all users.
  • Editor Improvements: These are dependent upon what editor is being used. However, Rosenwasser noted some things specific to the Visual Studio IDE and the Visual Studio Code editor for those developers who want to try out the latest functionality:
  • Some general editor improvements include:

    • Convert to Optional Chaining: New refactoring converts common patterns to take advantage of optional chaining and nullish coalescing.
    • /** @deprecated */ Support: TypeScript's editing support now recognizes when a declaration has been marked with a /** @deprecated * JSDoc comment.
    • Partial Semantic Mode at Startup: The team is working on a new mode for editors to provide a partial experience until the full language service experience has loaded up. This addresses slow startup times usually caused by the project loading process.
    • Smarter Auto-Imports: In editor scenarios, TypeScript 4.0 works to include any packages developers have listed in their package.json‘s dependencies field. This addresses problems associated with scenarios when auto imports don't seem to work.
  • Breaking Changes: These include:
    • lib.d.ts Changes: One notable change is that the removal of document.origin which only worked in old versions of IE and Safari. MDN recommends moving to self.origin.
    • Properties Overriding Accessors (and vice versa) is an Error: More on this can be found here.
    • Operands for delete must be optional: See more on this here.
    • Usage of TypeScript’s Node Factory is Deprecated: See more on this here.

Going forward, Rosenwasser pointed to the TypeScript 4.1 iteration plan, which sees v4.1 shipping on Nov. 17. The plan lists new language features and improvements focused on editor productivity, performance and infrastructure.

Developers can try out the latest and greatest features and functionality be using Nightly Builds or via the JavaScript and TypeScript Nightly extension available in the marketplace.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus

Featured

  • Death of the Dev Machine?

    Here's a takeaway from this week's Ignite 2020 event: An advanced Azure cloud portends the death of the traditional, high-powered dev machine packed with computing, memory and storage components.

  • COVID-19 Is Ignite 2020's Elephant in the Room: 'Frankly, It Sucks'

    As in all things of our new reality, there was no escaping the drastic changes in routine caused by the COVID-19 pandemic during Microsoft's big Ignite 2020 developer/IT pro conference, this week shifted to an online-only event after drawing tens of thousands of in-person attendees in years past.

  • Visual Studio 2019 v16.8 Preview Update Adds Codespaces

    To coincide with the Microsoft Ignite 2020 IT pro/developer event, the Visual Studio dev team shipped a new update, Visual Studio 2019 v16.8 Preview 3.1, with the main attraction being support for cloud-hosted Codespaces, now in a limited beta.

  • Speed Lines Graphic

    New for Blazor: Azure Static Web Apps Support

    With Blazor taking the .NET web development world by storm, one of the first announcements during Microsoft's Ignite 2020 developer/IT event was its new support in Azure Static Web Apps.

  • Entity Framework Core 5 RC1 Is Feature Complete, Ready for Production

    The first release candidate for Entity Framework 5 -- Microsoft's object-database mapper for .NET -- has shipped with a go live license, ready for production.

Upcoming Events