DEV Community

Cover image for Typescript scripts in the command line: The Conclusion
Renato Rodrigues
Renato Rodrigues

Posted on

Typescript scripts in the command line: The Conclusion

Conclusion and Final thoughts

In the previous articles in this series, we introduced an example Typescript script and implemented it in Deno 2.0 and Node.JS. The idea was to show how to achieve the same results using the two different technologies, enumerate the pros and cons of each implementation, and hopefully help you decide which one suits you better.

Adoption

Node.JS is the industry standard and has been around for over 15 years. Deno, on the other hand, is a more recent technology, especially the version 2.0. Using Deno in a more critical, conservative, or controlled environment could be difficult or even not allowed at all. In those cases, Node.JS could be a more suitable choice.

Deno 2.0 Implementation

Pros

  • No setup required
  • Native Typescript support
  • No transpilation required
  • Native support for NPM dependencies
  • Single-file script
  • No project file, lock file, or node_modules folder

Cons

  • Not widely available in existing Docker images and containers
  • Minimal, yet existing, learning curve
  • May face resistance or opposition to the adoption
  • May not be approved and allowed in highly controlled corporate environments

Node.JS Implementation

Pros

  • Familiar to developers and sys-admins, no learning curve
  • Widely available in the most commonly used images and containers
  • Approved for use in most environments

Cons

  • Doesn't run Typescript natively
  • Transpilation will be needed
  • Requires a project file, a lock file, and a node_modules
  • Your script is actually a multi-file project, not a single-file script
  • Has problems mixing CommonJS and ESM modules

The verdict

The Pros and Cons above can be of great help when choosing which technology to use. While I cannot assert which one is better for your scenario, I can say that in an environment where none of the cons are a concern, I personally would choose Deno 2.0 and advise you to do the same. However, if one of the cons is a no-go for you, it's better to stay safe in the Node.JS ship.

This concludes this series of articles on Typescript scripts on the Command Line. I hope you enjoyed it.

Stay tuned for more content like this.

Top comments (0)