Hello IH,
I am a beginner programmer and have begun building the backend for a small project of mine with NodeJS. Wondering if I should change the existing code to Typescript or stick with Javascript...
Context: I have written basic projects in Javascript and dabbled with Typescript in Angular.
What are your thoughts about using Typescript on the backend (NodeJS and Express)?
TIA 😁
Yes! Use typescript, it will help you in the long run a lot.
Hey Valboa, could you please elaborate? Trying to weigh up the pros and cons...
With Typescript (and with Typing in general) you can be thoughtful of the data structures and data model you want to serve with your backend services. Also, you can reuse the type definitions in the backend and share those with the front end to make it even easier to use. Maintaining it is also easier as it will help you find places where your system might break before shipping (IDE Support).
As with any technology, the issues with TS are heavy as well. TS critics mention boilerplate and lack of robustness from the typing system (because is a superset of JS).
TS will not solve for you basic decisions like data shapes and modeling, algorithms or network management. But it can help you, if you care about those.
Thank you. Appreciate you taking the time ☺️