A Node.js-be kísérleti támogatást kaptak a TypeScript nyelvhez

A JavaScript platform Node.js codebase has been updated to include the capability to execute files written in the TypeScript programming language. TypeScript support is enabled using the option “—experimental-strip-types” and involves the removal of type definitions specific to this language, i.e., transforming the source code into JavaScript before execution. TypeScript features that are not related to type definitions, such as namespaces, decorators, parameter properties, and enumerated types (enum), are not yet supported. You can test the new feature using today’s nightly builds of Node.js 23.

The SWC (Speedy Web 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, delivered in WebAssembly bytecode and already 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. Competing platforms Deno and Bun have initially implemented TypeScript support.

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

Forrás: opennet.ru

Megbízható hosting vásárlása weboldalak számára, DDoS védelemmel, VPS VDS szerverek. 🔥 Megbízható webtárhely vásárlása DDoS védelemmel, VPS VDS szerverek | ProHoster