New TypeScript 4.2 Tweaks Include Project Explainer
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.
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.
David Ramel is an editor and writer for Converge360.