logoalt Hacker News

codelikeawolflast Tuesday at 3:26 PM1 replyview on HN

> Did you (rightfully) want to tear your eyes out when some LLM suggested that you script with .mjs?

I respectfully disagree with this sentiment. JS is a fantastic Python replacement for scripts. Node.js has added all kinds of utility functions that help you write scripts without needing external dependencies. Bun, Deno, and Node.js can execute TS files (if you want to bring types into the mix). All 3 runtimes are sufficiently performant. If you do end up needing external dependencies, they're only a package.json away. I write all my scripts in JS files these days.


Replies

jswnyyesterday at 2:59 AM

The problem is that only Deno can type check single file scripts. Otherwise with Node and Bun you need a project to use tsc. Python can type check single file scripts (even with PEP 723 deps) with ty. Otherwise, I love TS for scripting, especially with Bun shell

show 1 reply