Can I transpile TypeScript Code to JavaScript Code with Deno like Bun
Hey I have 10/15 typescript files. SO can i transpile it into javascript code?
9 Replies
Yes, you can transpile TypeScript code to JavaScript using Deno. Deno has built-in support for TypeScript and handles the transpilation automatically. When you run or import TypeScript files, Deno will compile them just-in-time into JavaScript.
If you want to transpile TypeScript files and save the resulting JavaScript, you can use the
deno compile
command. This command will compile your TypeScript code into a standalone executable, but if you're looking to get the JavaScript output, you can use the deno bundle
command to bundle your code into a single JavaScript file.
Here's an example of how you might use deno bundle
:
This command will take your input.ts
TypeScript file and bundle it into a single output.js
JavaScript file. You can do this for each of your TypeScript files. Just replace input.ts
with the path to your TypeScript file and output.js
with the desired output filename for the JavaScript code.
Remember, Deno handles TypeScript out-of-the-box without any additional configuration, making it straightforward to work with TypeScript files. π¦deno bundle
is deprecated and will be removed in 2.0. Best to use esbuild and https://jsr.io/@luca/esbuild-deno-loaderJSR
@luca/esbuild-deno-loader - JSR
@luca/esbuild-deno-loader on JSR: Deno module resolution for
esbuild
@arrow Why?
Seriously
Asking
:(((
esbuild is a more expansive and fleshed out solution than
deno bundle
. Also deno bundle
gave the impression to people that they could bundle for the web, which is not true, as it would just bundle all the files in module graph into a single file to be consumed, as mainly for distributive purpouses.Makes senseπ€ Did you see the messages in general? This transphobe was makin me anxious
yes, apologies about that, tried to reach out directly via DMs but since you have DMs closed, I wasnt able to.
A stern one-time warning was given, and if anything like that happens again, let me know instantly and I will take care of it.
Thank you.β£οΈ Like I know I'm not exactly conventional and I try to be low-key but then this happens. Anyway, just an fyi. Thank you very much for always being so kind.
no problem, and we do adhere to the rust code of conduct, so dont worry
I know some other team members might have banned that person instantly, but i am of the opinion people should be given a second chance, even if very unlikely to be effective
That certainly seems fair! I know you do, had a look today. Did you get my friend request?
#off-topic π€¦π½ββοΈ