News

What's New in TypeScript 3.5

Less than two weeks after the release candidate, Microsoft has shipped the final release of TypeScript 3.5, the increasingly popular programming language that improves upon JavaScript by allowing optional static typing.

The open source, cross-platform language was even said to be "exploding" in popularity in an analyst report earlier this month.

One of the main highlights of this release is actually a fix for a type-checking bug the TypeScript team introduced in v3.4 that caused longer build times and made TypeScript/JavaScript editor operations "unbearably slow." As Visual Studio Magazine noted, that bug was fixed in the release candidate.

Other improvements in the compiler/language department as detailed by program manager Daniel Rosenwasser include:

  • The Omit helper type: This lets developers omit certain properties from an object, such as creating a Person type without a location property. See more here.
  • Improved excess property checks in union types: This improves excess property checking in object literals, a feature used to detect typos for when a type isn't expecting a specific property in a union of two constructs. For example, a const created from a union of a Point and Label now will be flagged if it tries to assign a boolean to a property expecting a string. See more here.
  • The --allowUmdGlobalAccess flag: "In TypeScript 3.5, you can now reference UMD global declarations like export as namespace foo; from anywhere -- even modules -- using the new --allowUmdGlobalAccess flag." See more here.
  • Smarter union type checking: This improves upon union type checking that was previously compared each constitutent type in isolation. Now it digs deeper to see if a type is allowable. It stems from a pull request titled "Relate source types covered by a target discriminated union." See more here.
  • Higher order type inference from generic constructors: This stems from a pull request to "support higher order inferences for constructor functions and to permit function type arguments to higher order composition functions to have other members in addition to their single call signature." See more here.

In the editor tooling department, Rosenwasser called out:

  • Smart Select: "TypeScript 3.5 provides an API for editors to expand text selections farther and farther outward in a way that is syntactically aware -- in other words, the editor knows which constructs it should expand out to. This feature is called Smart Select, and the result is that editors don't have to resort to heuristics like brace-matching, and you can expect selection expansion in editors like Visual Studio Code to 'just work"'." See more here.
  • Extract to type alias: Coming from an open source contributor, this is described by Rosenwasser as "a useful new refactoring to extract types to local type aliases." See more here.

Going forward, developers can expect a v3.6 beta on July 12, with the final version set for Aug. 23. It will include expected work items ranging from strongly typed iterators and generators (in the language department) to APIs for --incremental builds and project references (in the compiler department) to a release overhaul (in the infrastructure department) to "Await feedback for more completion priority improvements" (in the editor features department). All of this and much more is detailed in the TypeScript 3.6 iteration plan.

Looking further down the road, the laundry list of new features in the TypeScript road map includes:

  • Variadic types
  • Investigate nominal typing support
  • Flattening declarations
  • Implement ES Decorator proposal
  • Implement ES Private Fields
  • Investigate Ambient, Deprecated, and Conditional decorators
  • Investigate partial type argument inference
  • Quick fix to Scaffold local @types packages
  • Investigate error messages in haiku or iambic pentameter
  • Decorators for function expressions/arrow functions

Note that the possibility of providing error messages in haiku or iambic parameter is still a hot item, with our own .NET expert columnist Peter Vogel offering up the following nugget in a comment on an earlier article that mentioned the poetic PR:

Reference is null.
Reflect: Cold nature also
Abhors a vacuum.

However, Rosenwasser has said the issue has taken a back seat to more important issues, even throwing some shade on the original idea: "Besides, we'd probably do limericks first anyway. A haiku doesn't even rhyme."

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube