Why I switched to TypeScript
Zoltán Szőgyényi
7 replies
Hey peeps 👋
I would like to share my thoughts of my experience of switching over an entire component library powered by vanilla JS to TypeScript (talking about Flowbite) and what was my experience.
First of all, I've been a web developer for over 10 years and I have never ever wrote or even considered switching to TypeScript for one simple reason: I was lazy and wanted speed over safety.
This has been true for me a long while because I've only ever built small and medium sized projects and never felt the need to introduce types in my projects.
The library that I'm talking about is one of my first projects that started getting used on a large scale and introducing new features and building on top of existing code became scarier as the project got larger.
Based on this problem and also the demand from the community I decided to give TypeScript a chance - it was love and hate at the first sight.
Love because as I started to introduce types and update the existing code it felt like I was doing a spring cleaning and I've spotted countless of inconsistencies where objects sometimes had values that shouldn't have been there.
Hate because it does take more time to introduce new features and make sure that the code follows TypeScript best practices.
All in all, a few days ago I finally launched the TypeScript version of Flowbite and the community feedback has been great and at the end of the day, I would probably keep using TypeScript for projects that I believe to become adopted on a larger scale.
One thing that I loved is that I use VS Code it had really good integration tools for TypeScript including ESLint and native editor features - big, big plus!
How about you? Do you use TypeScript? Is it a love and hate relationship?
Share your thoughts!
PS: here you can find more details about the TS integration: https://flowbite.com/docs/getting-started/typescript/
Replies
Manoj Radhakrishnan@manoj_radhakrishnan1
HyperSwitch
Interesting.. Why did you prefer speed over safety?
Share
HyperSwitch
@zoltanszogyenyi Makes sense. But had you validated your idea and gone to the next step would you still prefer speed over safety?
@manoj_radhakrishnan1 I prefer to ship and validate my idea before trying to optimise it
I recently learned it and will use it now onward, I love it when I type dot(.) after an object and all its properties pops up!
@faisalamin001 I also love that - very convenient!
interesting take, I'm on JS as of now, will surely explore
HyperSwitch
Try using Rescript.