News

New TypeScript 4.2 Tweaks Include Project Explainer

Microsoft shipped TypeScript 4.2 -- the regular quarterly update to the open source programming language that improves JavaScript with static typing -- with a host of tweaks including a way to explain why files are included in a project.

In announcing the new version this week, program manager Daniel Rosenwasser highlighted 10 top new items of interest, including a new --explainFiles flag that does exactly what its name suggests.

The new flag stems from an August 2020 pull request (#40011) titled "Keep track of why files are in the program."

That resulted in the new tsc --explainFiles flag that trips the compiler into generating verbose ouput explaining why a file is in a program. That verbose output can in turn be injected into a text file, for example, or a utility program or a code editor like Visual Studio Code for easy viewing.

"A surprisingly common scenario for TypeScript users is to ask 'why is TypeScript including this file?' " Rosenwasser explained. "Inferring the files of your program turns out to be a complicated process, and so there are lots of reasons why a specific combination of lib.d.ts got used, why certain files in node_modules are getting included, and why certain files are being included even though we thought specifying exclude would keep them out."

He explained how the typical output looks as it details the reasoning behind the inclusion of those lib.d.ts files, then the the local files and then the node_modules files, though the format of the output may change in the future, something the team would like to hear feedback on.

Other tweaks highlighted by Rosenwasser -- with links for more information -- include:

Also, several breaking changes are in this release.

Going forward, the TypeScript 4.3 Iteration Plan provides a peek into what's in store with the next quarterly version, scheduled for May 25.

That plan lists upcoming language features, editor productivity improvements, better performance and enhancements to infrastructure and more.

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

It also calls for improvements to the new TypeScript web site that was unveiled in the August 2020 v4.0 milestone release.

Planned improvements to the web site include:

  • Continue smoothing out first user experience
  • Create project setup documentation
  • Fix display issues on sample error spans
  • Switch to new handbook

Other things planned for v4.3 are listed in the TypeScript Roadmap:

Going even further out, the dev team says "Future" plans include a number of significant initiatives, including a proposed item dating back to 2014, "Investigate nominal typing support" as explained in a GitHub issue titled "Support some non-structural (nominal) type matching."

It proposes to "support non-structural typing (e.g. new user-defined base-types, or some form of basic nominal typing). This allows programmer to have more refined types supporting frequently used idioms [such as indexes that come from different tables]."

That issue has garnered a lot of discussion and activity, being marked by a whopping 508 "thumbs-up" 👍symbols and 401 comments.

Other issues tasked for "Future" consideration include:

Microsoft is soliciting feature requests, bug reports and library improvements on GitHub here, where there are also links to the language's FAQ, Stack Overflow Q&A, Discord chat and more.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus

Featured

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

  • What's New for Python, Java in Visual Studio Code

    Microsoft announced March 2024 updates to its Python and Java extensions for Visual Studio Code, the open source-based, cross-platform code editor that has repeatedly been named the No. 1 tool in major development surveys.

Subscribe on YouTube