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 at Converge 360.

comments powered by Disqus

Featured

  • Hands On: New VS Code Insiders Build Creates Web Page from Image in Seconds

    New Vision support with GitHub Copilot in the latest Visual Studio Code Insiders build takes a user-supplied mockup image and creates a web page from it in seconds, handling all the HTML and CSS.

  • Naive Bayes Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the naive Bayes regression technique, where the goal is to predict a single numeric value. Compared to other machine learning regression techniques, naive Bayes regression is usually less accurate, but is simple, easy to implement and customize, works on both large and small datasets, is highly interpretable, and doesn't require tuning any hyperparameters.

  • VS Code Copilot Previews New GPT-4o AI Code Completion Model

    The 4o upgrade includes additional training on more than 275,000 high-quality public repositories in over 30 popular programming languages, said Microsoft-owned GitHub, which created the original "AI pair programmer" years ago.

  • Microsoft's Rust Embrace Continues with Azure SDK Beta

    "Rust's strong type system and ownership model help prevent common programming errors such as null pointer dereferencing and buffer overflows, leading to more secure and stable code."

  • Xcode IDE from Microsoft Archrival Apple Gets Copilot AI

    Just after expanding the reach of its Copilot AI coding assistant to the open-source Eclipse IDE, Microsoft showcased how it's going even further, providing details about a preview version for the Xcode IDE from archrival Apple.

Subscribe on YouTube

Upcoming Training Events