Node.js has added experimental support for the TypeScript language.

A change has been introduced to the JavaScript codebase of the Node.js platform, allowing the execution of files written in TypeScript. Support for TypeScript is enabled using the option "—experimental-strip-types" and involves stripping type definitions specific to this language, meaning that the source code will be transformed into JavaScript before execution. Features of TypeScript that are not related to type descriptions, such as namespaces, decorators, parameter properties, and enumerated types (enum), are not yet supported. You can test this new feature using today’s nightly builds of Node.js 23.

The SWC (Speedy Web Compiler) compiler, written in Rust, is used for the transpilation. To avoid adding additional dependencies to Node.js, the swc/wasm-typescript compiler representation is utilized, which is provided in WebAssembly bytecode and is already being used for the same purposes in the Deno platform. This change was made in response to numerous user requests to enable the execution of TypeScript code without installing external loaders and additional dependencies. TypeScript support was built into competing platforms Deno and Bun from the outset.

The key difference between TypeScript and JavaScript is the explicit definition of types. Static typing helps avoid many errors during development, enables additional optimization techniques, simplifies debugging, and makes the code more readable and easier to modify and maintain for external developers. In the Node.js implementation added, these TypeScript features are lost, as type checking is not performed during the transpilation of source texts into JavaScript.

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster