DEV Community

Cover image for Heard about DENO?
Anders Persson
Anders Persson

Posted on • Edited on

Heard about DENO?

Disclaimer; I'am a backend developer, and try to keep up with frontend, so this (my first) article can be basic for many frontend developers.

Deno has the same creator as NODEJS (Ryal Dahl), Deno was a project started because Ryal had many things he learned working with Nodejs, and like to change, but it was easier to start over.

Focus in Deno is Security, and it is ALL CLOSED BY DEFAULT, so a script has to get ok, for write, read .. , and latest version access can be set on domain level.

Another big thing is DENO doesn't have a package handler, like node, you don't download stuff, you access them the same way as you do in webpages. But.. to make transit from Node easy today Deno understands NPM, so you can slowly rewrite if you like.

But, the big thing for me is deno runs TypeScript out-of-the-box, without setting up anything, just have an .ts extension and you can do a

deno run myscript.ts

of course

deno run myscript.js

for javascript works to.

Example myscript.js

console.log("Hello World");
Enter fullscreen mode Exit fullscreen mode

Example myscript.ts

function addHello(data: string) {
    return `Hello ${data}`;
}
console.log(addHello("World"));
Enter fullscreen mode Exit fullscreen mode

But there is another nice thing, you can write scripts for terminal, and make a standalone binary, which runs without deno, but don't forget to allow access rights, like if your script likes to read a folder, else it will not be allowed to do this.

deno compile myscript.ts

Om my windows machine it gives me a myscript.exe
This is just a scratch what Deno can do, read more at deno homepage
Link: deno.land

Happy hacking!
Anders

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

11 Tips That Make You a Better Typescript Programmer

typescript

1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields

...

Read the whole post now!

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay