Paul Krill
Editor at Large

Node.js unveils experimental TypeScript support

news
Aug 08, 20242 mins
Development Libraries and FrameworksJavaScriptNode.js

Node.js v22.6.0 introduces experimental feature that strips type annotations from TypeScript files, allowing them to run without changing TypeScript syntax.

Hands type on a laptop keyboard with lines of code visible on the display.
Credit: SeventyFour / Shutterstock

Node.js v22.6.0, the newest version of the popular JavaScript runtime, has just been released with experimental TypeScript support.

Node.js 22.60 introduces the --experimental-strips-type flag for initial support for TypeScript, Microsoft’s popular JavaScript variant that has syntax for types. The Node.js update was released August 6. Node.js downloads can be accessed from nodejs.org.

The TypeScript capability strips type annotations from .ts files, enabling them to run without transforming TypeScript-specific syntax. The support is currently limited to inline type annotations, and does not include features such as enums or namespaces. Additionally, explicit file extensions are required in import and require statements. The feature also enforces the use of the type keyword for type imports to avoid runtime errors, and is disabled for TypeScript in node-modules by default. The addition of TypeScript support, though, puts Node.js more in line with the rival Deno runtime, which supports JavaScript, TypeScript, and WebAssembly.

Also featured in the Node.js v22.60 update is initial support for network inspection. This also is an experimental feature, which developers must enable using the --experimental-network-inspection flag. With this feature enabled, developers can inspect network activities occurring within a JavaScript application. To use network inspection, developers can start a Node.js application with the following command:

$ node --inspect-wait --experimental-network-inspection index.js

Network inspection capabilities are in active development but currently limited to the http and https modules, the project said. Additionally, the Network tab in Chrome DevTools will not be available until the feature request on the Chrome DevTools side is addressed.