Deno 1.21 improves REPL, error handling

Deno 1.21 has been unveiled. This hottest update to the JavaScript/TypeScript runtime features enhancements to the REPL (examine-consider-print loop) and a transfer away from default form-examining.

The Deno REPL is a resource for prototyping and attempting out new matters. With Deno 1.21, an -–eval-file flag can be applied with the deno repl subcommand. This flag will allow for passing of a list of paths or URLs to information that will be executed ahead of the REPL starts and is handy for setting up custom, specialised REPLs. Also, style examining has been disabled for imported modules in the REPL, foremost to quicker imports. And the REPL now has a global clear() purpose that acts as an alias for console.apparent. This aligns with what is uncovered in REPLs in a lot of browsers, Deno’s developers mentioned.

Deno 1.21 begins a path toward disabling sort examining by default in deno run. Sort checking will need to be executed explicitly working with a new deno verify subcommand. This improve will be phased in progressively, with the new launch including a deno check subcommand and a DENO_Future_Look at=1 ecosystem variable that can be set to swap Deno into the new “no type check out by default” manner that will turn into the default in the long run.

Note that this transform does not imply TypeScript aid is being removed from Deno. In describing the reasoning driving the improve, Deno’s developers stated recent years have proven the usefulness of annotating JavaScript code with variety facts. But type examining can be slow and impact software startup effectiveness. Most developers now use an IDE that surfaces the results of sort checking at growth time. On top of that, JavaScript is on a path toward finding indigenous style annotations.

Announced April 21, Deno 1.21 can be downloaded by latest consumers via the deno improve command. Instructions for new customers can be located in release notes.

Other new characteristics and advancements in Deno 1.21 contain the subsequent:

  • Deno’s mistake-managing habits is now aligned for uncaught exceptions in asynchronous event loop responsibilities like setTimeout, setInterval, or occasion handlers to the browser. A world “error” party will be dispatched for uncaught exceptions in the above-mentioned APIs.
  • The unstable Deno.upgradeHttp API, which can be utilized to conduct HTTP protocol switches, now supports protocol switches on HTTP servers functioning on top of Unix connections.
  • A DENO_NO_PROMPT environment variable has been extra. When established, Deno will disable all interactive prompts, even when the output is an interactive terminal. This has an equivalent effect to specifying –-no-prompt on all invocations to the denocode binary.
  • Built-in screening amenities have been improved. In a single enhancement, deno test will filter out stack frames coming from Deno’s internal code and exhibit the line of code where the error originates.

Copyright © 2022 IDG Communications, Inc.