moleculerjs / moleculer

:rocket: Progressive microservices framework for Node.js
https://moleculer.services/
MIT License
6.11k stars 580 forks source link

Feature Request - Complete TypeScript Implementation #1215

Closed zolero closed 1 year ago

zolero commented 1 year ago

Is your feature request related to a problem? Please describe.

While the current JavaScript implementation of moleculer.js has served well, there have been instances where runtime errors and potential bugs could have been avoided if the package had been designed using TypeScript. The lack of static typing and autocompletion can lead to slower development speed and potential errors.

Describe the solution you'd like

I propose upgrading the package to support a complete TypeScript implementation. TypeScript, as a statically typed superset of JavaScript, provides robust type checking capabilities which help in catching potential bugs during compile-time, rather than at runtime. It also offers superior tooling, including autocompletion, type inference, and documentation capabilities. Additionally, TypeScript code can be more readable due to the availability of type annotations, thus making the package more maintainable.

Describe alternatives you've considered

As an alternative, we could consider introducing TypeScript gradually, by using it in certain parts of the package and progressively expanding its use. However, given the advantages of TypeScript over JavaScript, a full transition would still be the most beneficial in the long term.

Additional context

TypeScript is future-proof, as it is constantly updated to include the latest ECMAScript features. This ensures that the package will stay compatible and modern as the JavaScript standard evolves.

Despite being a different language, TypeScript is compiled down to JavaScript and thus maintains full compatibility with JavaScript code. This allows developers to gradually adopt TypeScript, or even to use both languages in the same project.

This proposed upgrade would not alienate developers who prefer JavaScript, but it would open the door to the growing number of developers who prefer TypeScript for its additional safety and tooling features.

The upgrade to TypeScript, although substantial, represents a significant investment in the long-term quality and sustainability of the moleculer.js. It is, in my view, a progressive move that would greatly improve the package's overall development experience and code reliability.

ccampanale commented 1 year ago

Not sure how accurate this is but "moving to TypesScript" is apparently on the v1 roadmap project.