The latest version of Microsoft’s strongly typed JavaScript introduces support for ECMAScript modules in Node.js, adds coding enhancements. Credit: Thinkstock TypeScript 4.7 became generally available as a production release on May 24. The latest version of Microsoft’s strongly typed JavaScript, TypeScript 4.7 arrives with ECMAScript module (ESM) support for Node.js 16 as well as a multitude of coding enhancements. ESM support for Node.js 16 was a late addition to the release. The TypeScript 4.7 beta introduced April 8 included ESM support for Node.js 12, which had been planned for TypeScript 4.5 late last year but was delayed. However, because Node.js 12 is no longer supported, TypeScript’s builders started the stable target at Node.js 16. This not only provides newer ECMAScript module functionality such as pattern trailers, but also defaults TypeScript to a higher target that supports top-level await. Nightly-only support for ECMAScript modules in Node.js was rolled out in the TypeScript 4.5 timeframe. These modules enable reuse of code via packaging. Implementing this support has been difficult because Node.js was built on a different module system, CommonJS. TypeScript 4.7 adds this functionality with two module settings, node16 and nodenext. Feedback on this capability is sought and can be offered on GitHub. TypeScript 4.7 can be downloaded via NuGet or NPM: npm install -D typescript Other capabilities in TypeScript 4.7 include the following: Control flow analysis for bracketed element access now narrows the types of element accesses when the indexed keys are literal types and unique symbols To control module detection, TypeScript 4.7 introduces the option moduleDetection. A moduleSuffixes option is supported to customize lookup of module specifiers. TypeScript now can perform more granular inferences from functions with objects and arrays. This allows types of these functions to consistently flow in a left-to-right manner, just like for plain arguments. Functions and constructors can be fed type arguments directly. Developers can explicitly specify variance on type parameters. Organize Imports is performed in a group-aware manner. Snippet completions are provided for object literal methods. A readonly tuple now will treat its length property as readonly. This is a breaking change. A preview editor command is featured for Go to Source Definition. In another breaking change, when writing a …spread in JSX, TypeScript now enforces stricter checks that the given type is actually an object. As a result, values with the types unknown and never, and, more rarely, null and undefined, no longer can be spread into JSX elements. Following the beta, TypeScript’s builders found that a typeof capability on #private fields, which had been planned for the release, had issues with API compatibility. The team also began doubting whether typeof this.#somePrivate composes well on declaration emit. As a result, this capability has been left out of TypeScript 4.7. A release candidate for TypeScript 4.7 was published on May 11. The previous version, TypeScript 4.6, which brought capabilities such as ECMAScript 2022 support and recursion checks, was published February 28. Related content feature What is Rust? Safe, fast, and easy software development Unlike most programming languages, Rust doesn't make you choose between speed, safety, and ease of use. Find out how Rust delivers better code with fewer compromises, and a few downsides to consider before learning Rust. By Serdar Yegulalp Nov 20, 2024 11 mins Rust Programming Languages Software Development how-to Kotlin for Java developers: Classes and coroutines Kotlin was designed to bring more flexibility and flow to programming in the JVM. Here's an in-depth look at how Kotlin makes working with classes and objects easier and introduces coroutines to modernize concurrency. By Matthew Tyson Nov 20, 2024 9 mins Java Kotlin Programming Languages analysis Azure AI Foundry tools for changes in AI applications Microsoft’s launch of Azure AI Foundry at Ignite 2024 signals a welcome shift from chatbots to agents and to using AI for business process automation. By Simon Bisson Nov 20, 2024 7 mins Microsoft Azure Generative AI Development Tools news Microsoft unveils imaging APIs for Windows Copilot Runtime Generative AI-backed APIs will allow developers to build image super resolution, image segmentation, object erase, and OCR capabilities into Windows applications. By Paul Krill Nov 19, 2024 2 mins Generative AI APIs Development Libraries and Frameworks Resources Videos