“Node.js Adds Experimental TypeScript Support: Crucial Ecosystem Move, But With Limitations”

The Node.js project now supports TypeScript through an “experimental” flag. TypeScript support is essential for the ecosystem’s progress and has been frequently requested, according to Technical Steering Committee member Marco Ippolito. With this feature, users can run .ts files without installing additional dependencies or loaders.

The experimental flag is named –experimental-strip-types, which removes types from the code and transforms TypeScript into JavaScript. However, not all TypeScript features are supported, such as enums and namespaces. Settings in tsconfig.json are ignored, and source maps are not generated. TypeScript files located in node_modules are not supported to discourage authors from publishing packages written in TypeScript.

TypeScript, a strongly typed language, compiles to JavaScript and is popular for browser or runtime applications like Node.js. In surveys, TypeScript ranks among the top ten programming languages. While it can detect coding mistakes before deployment, lightweight support coming to Node.js does not perform type-checking.

Created by Ryan Dahl in 2009, Node.js remains the most popular JavaScript runtime. Alternatives like Deno and Bun use TypeScript, but only Deno can type-check it by default for performance reasons. Since built-in TypeScript support will be convenient, it’s essential to also use other tools like TypeScript’s compiler for full benefits. There is a concern that new TypeScript versions may not align with Node.js if using long-term support versions. However, the roadmap includes plans for more features in the future.

As another developer stated, this is an exciting feature coming to Node.js, despite limitations.
Source: https://devclass.com/2024/07/26/node-js-adds-experimental-typescript-support-as-it-simply-cannot-be-ignored/