News for hackers. Stuff that matters.
Re:Deno Deploy Demo: a multi-datacenter chat, client+server ... by zcbenz on Sunday November 07, 2021 @01:19AM (#29137023)
I'm a bit confused when people say "native TypeScript" and "no transpiling" about Deno, does Deno now execute TypeScript without translating it to JavaScript first?
Re:Deno Deploy Demo: a multi-datacenter chat, client+server ... by koprulusector on Sunday November 07, 2021 @01:34AM (#29137074)
It always did. That’s been a core feature / benefit from day 1.
Re:Deno Deploy Demo: a multi-datacenter chat, client+server ... by capableweb on Sunday November 07, 2021 @02:38AM (#29137326)
No, it never did, Deno always have converted TypeScript into JavaScript that then gets read and executed by the browser, at least according to their own docs but maybe that has changed lately?

> At a high level, Deno converts TypeScript (as well as TSX and JSX) into JavaScript. It does this via a combination of the TypeScript compiler, which we build into Deno, and a Rust library called swc. When the code has been type checked and transformed, it is stored in a cache, ready for the next run without the need to convert it from its source to JavaScript again.

https://deno.land/manual/typescript/overview

Re:Deno Deploy Demo: a multi-datacenter chat, client+server ... by koprulusector on Tuesday November 09, 2021 @06:03AM (#29160099)
My answer wasn’t explicit enough. To clarify, I meant as a user of deno you do not need to perform any separate transpilation or build step. The runtime can read and execute typescript natively (again, from user perspective).

>Deno can run JavaScript or TypeScript out of the box with no additional tools or config required.

- https://deno.land/[email protected]/examples/hello_world

>Deno is a runtime for JavaScript/TypeScript which tries to be web compatible and use modern features wherever possible.

- https://deno.land/[email protected]/getting_started/first_steps

You can run any of their examples to see that `deno run` commands can execute typescript without requiring a separate transpilation step

Re:Deno Deploy Demo: a multi-datacenter chat, client+server ... by capableweb on Tuesday November 09, 2021 @08:29AM (#29161429)
Yeah, I guess if someone asks "does Deno translate TS to JS before executing it?" and someone answers "Yes, it could always do this", it's not hard for the answer to be understood as "Deno doesn't translate TS before running it".

No hard feelings though, context is important and many of us miss it at times :)

Re:Deno Deploy Demo: a multi-datacenter chat, client+server ... by satori99 on Sunday November 07, 2021 @02:42AM (#29137338)
It's native in so far as it embeds the transpiler and hides it from the user. It is still JavaScript under the hood.

https://deno.land/[email protected]/typescript/overview#how-doe...

Re:Deno Deploy Demo: a multi-datacenter chat, client+server ... by bryanrasmussen on Sunday November 07, 2021 @02:27AM (#29137283)
so question - normally the thing I like about Node.js is not much context switching and ability to rerun code between backend and frontend. I can get the same thing with TS if I compile in both backend and frontend - if in Deno I don't compile and in the frontend I do are there any weird gotchas I would run into?
Re:Deno Deploy Demo: a multi-datacenter chat, client+server ... by andyferris on Sunday November 07, 2021 @05:27AM (#29138106)
Deno is aiming to have better compatibility with web standards than Node, so you should encounter fewer gotchas from reusing code in backend and frontend.