TypeScript is great but sometimes, using it can turn out to be an unnecessary waste of time.
Being a former C# programmer, I’m a big fan of TypeScript and strongly-typed programming languages — having said that, I know better than to use it in every project. In this article, we’ll go through the times where TypeScipt serves its purpose perfectly and other times where using it is an unnecessary waste of time.
Want to know when not to use TypeScript? Let us first define what TypeScript is.What is TypeScript?
Microsoft has designed TypeScript mainly with large applications in mind such as enterprise applications with over 500 users or more. TypeScript can also be used in back-end apps such as NodeJS for strongly-typed language.
Now let us know when not to use TypeScript at all. Here are some use-cases which you might reconsider the use of TypeScript:When building small apps or prototypes
Let us compare the two code when programming some features:
const myFunction = (x, y) => x * y;
const myFunction = <T>(x: T, y: T) => x * y;
Adding TypeScript code in the project requires us to declare types such as this example and you might hate doing that during the prototyping phase.
Notice here that the ones using TypeScript are noisier since we need to declare types to get the job done. Although one could argue that the one using TypeScript is verbose and easy to debug when things get bad for this functionality but that depends on how you or your developer will make use of the type system. Your developer may just simply toss in a lot of
any as type in the function so it may not be that helpful at all.
This use-case is debatable though since one might argue that it will save us a lot of time by adding type-checking ahead of time and prevent bugs that might give you some headaches as you build your prototype. It’s true that static types may save you a lot of time in the long run, but not when you’re building your own prototype that might not get to the next stage nor profit it deserves at this point.
TypeScript is only good when it delivers the results it promises but bad if it fails to deliver. You must know first the reason why you want to use and apply it in projects in the first place before actually delving deeper to use it. If it’s not improving your productivity nor the durability of the app you’re building, then you’re not getting much value out of it.
For example, identify first the type of app that you are about to build. Is it a prototype? An enterprise? An API that will be consumed by hundreds of developers? An app that is only focused on User Interactions or Animations? Or an app filled with complex computations and formulas?
You need to evaluate the effectiveness and values TypeScript can offer you first in your use-case then use it so that you can get the most out of it.When your developers are inexperienced and not willing to adapt in it
You can carefully evaluate and observe how experienced your developers are in using TypeScript. You can also gauge how much learning curve time do they need when they’re going to use it. If you have a bunch of developers who don’t know TypeScript, you might have to back out in enforcing this technology to them unless there’s ROI in doing so.
We cannot always enforce our team to adapt to TypeScript unless there’s a compelling reason to do so and depending on the type of projects your team handles. This also depends on the type of skillsets they have before you enforce it to them. Do they have OOP backgrounds such as C# and Java? If not, this will only cause harm than good.
Lastly, I think it’s worth asking your team whether they’re willing to adapt and use this technology. It could be selfish on your part to just enforce it without gauging your team’s skillsets, proper justification, and analysis of the problem you’re solving.
The need for TypeScript needs to be further analyzed before we delve deeper and use it in your projects with your team and they will thank you for that!When you’re using it because of “hype”
Last but not least, if you’re just using TypeScript for the sake of “hype”, I think you’re in the wrong direction. For practice and getting the hang of TypeScript, there is no problem in using it. But to use it in production apps just because of “hype” is unreasonable and not a good indicator that this will add value.
I’ve been in that situation wherein I jump back and forth in new technologies that I come across. But as I grew more mature as a Software Engineer, I realized that it’s pointless to delve into new technologies or hypes if it fails to provide the value that we offer.Conclusion
I hope I helped you decide when or when not to use TypeScript in your projects based on the use-cases that I outlined above.
Best Mobile App Development Company India, WebClues Global is one of the leading web and mobile app development company. Our team offers complete IT solutions including Cross-Platform App Development, CMS & E-Commerce, and UI/UX Design.
We are custom eCommerce Development Company working with all types of industry verticals and providing them end-to-end solutions for their eCommerce store development.
Know more about Top E-Commerce Web Development Company