A recent upgrade to Deno, the JavaScript and TypeScript runtime positioned as a rival to Node.js, improves performance for transpiling, type checking, and more, proponents say.
Prior to the Deno 1.24 release, Deno internally converted TypeScript code to JavaScript using the TypeScript compiler when the --check
flag was specified; otherwise, it used swc, a Rust-based platform for the web. Now, all emitting is done via swc
, which is significantly faster. Thanks to architectural refactors, emitting no longer happens with deno check
, and the cache used to store emitted JavaScript has improved. Also, Deno is smarter about not type checking if it has already type-checked some of the code previously.
This roster of new features and upgrades should offer considerable performance improvement, but results will vary depending on the codebase.
More new features and support in Deno 1.24
Additional features and support in the July 21 version update include the following:
- Support has been added for the unhandledrejection event, which is useful for debugging and fallback error handling for unexpected situations.
- The beforerunload event, also now supported, lets a web page trigger a confirmation dialog asking a user if they want to leave a page. If confirmed, the browser navigates to the new page.
- An
import.meta.resolve()
API allows for resolving specifiers relative to the current module. - Performance has been improved for the unstable Foreign Function Interface.
- Auto import support in the editor has been improved for the Language Server Protocol.
- The unstable subprocess API has been improved. One upgrade involves change to the types of stdio streams; instead of complicated generic types describing which streams are available, these now are simple, always-available streams.
- Variable expansion has been enabled in the
dotenv
standard module.
Developers already using Deno can upgrade to the latest version by running: deno upgrade
. The Deno website includes additional instructions and methods for installing the Deno runtime.