Why have all JavaScript developers not moved to TypeScript?
I asked this question on Twitter last week and got ~100 replies.
Sharing my learnings from the responses, as it gives insight into what keeps developers from migrating to new tech. Even when the alternative is better.
Let’s get into it.
TL;DR
- Conquering JavaScript first
- Vanilla JavaScript works
- Sorry, too soon
- Well, it depends
- ECMA is getting there
Conquering JavaScript first 👨🏫️
A lot of newbies and beginners gave the “I am still learning JS” response.
Understandably they don’t want to take up more than they can chew at the moment.
Most of them are interested in trying it out in future, whereas some were looking for guidance on if they should.
Vanilla JavaScript works 👌
Developers already working with JS, had a pressing question → “What’s the need?”.
They don’t plan to migrate due to having a large codebase written in JavaScript, ease of debugging, or simply because they are comfortable with JS as it gets the job done.
Their motto: “If it works, don’t touch it”.
Sorry, too soon 🕒
Some experienced JS developers have learned TypeScript in plans, but think the right time has not come yet.
Unlike developers who are not willing to migrate, these devs see value in TypeScript. Just that they didn’t get the right project yet, which justifies the learning curve.
Also, they are hoping that tooling (like support for running TS code natively in the browser) will improve in the future.
Well, it depends 🧐
Some developers have spent time learning TypeScript, but don't use it for every project.
As per them, it’s suited when:
- Working in a team
- Writing production apps
- Codebase is huge
They said "For personal projects and simple apps, TypeScript is an overkill".
ECMA is getting there 🏁
Lastly, a few responses were about ECMA 6 already supporting enough modernity to write clean code in JS.
These devs suggest, if you understand JavaScript well enough with tooling built around it, you don’t need TypeScript.
Also, they are hopeful that useful features in TypeScript will eventually be included in native JavaScript so why bother with 2 learning curves.
Wrapping up 📝
Share in comments your motivation to move or not move to TypeScript?
If you liked this post, you can follow me for more of these.
Latest comments (44)
I'm interested in learning TypeScript but the tooling and setup just feels like too much to handle; It's also confusing compiling in the first place.
When I can do:
Without any transpiling, I'll consider it.
@codewithvoid Interesting no one mentioned the cost of TypeScript.
Some time ago I wrote an article: We’re not writing our code in TypeScript, why?
This is a tricky statement. I'm sure you could defend that position for a specific definition of the word 'beter'. But when including certain factors using TypeScript is not better.
Language is common. The more you know, the better lewdle
I know it's a newbie mentality but I don't like the syntax and the fact that I have to install types separately in a react app
Type notation isn't particularly useful.
I haven't conquered JS yet but all of my projects are written in TypeScript. Long live Types. I can't explain how much it helps me to avoid silly and subtle bugs.
I could see legitimate use cases for Typescript with a Node app or API that is going be consumed by other teams within an organization, but I’ve flatly said no to a couple developers that I manage that we will not be using it in our main React-based web app. No one thus far has been able to make a compelling case as to why it would be useful enough from a cost/benefit perspective for build user interfaces when we control the structure of the data. Conversely, I’ve been involved in several projects over the years where using TypeScript was a net negative for developer productivity.
Using it on a new project now, and once you get the hang of it it just starts feeling "natural", it does not feel like a hassle/restrictive/cumbersome, you start seeing the benefits, and at some point you won't want to go back to JS - that's my personal experience. More or less learned it "on the job" gradually picking it up, not that hard.
Typescript is not difficult to learn. Whether you use it will depend on your project. If your project is tiny, such as 2–5 pages, use JS; nevertheless, if it is large, I would suggest typescript.
I used to question why I should learn Typescript when JavaScript can do anything. I was reading through TypeScript's documentation around two months ago, and my head was racing with all the different concepts like generics and interface.
A great tool for open source projects is typescript. And how you use it is up to you. Nobody is pressuring you.
By the way, I'm currently working on a piece explaining Typescript's main concepts with some excellent examples. You may adhere to me for that (Shameless Plugin)
Typescript is safe for runtime?
LoL
any suggestion where to learn typescript?
When you TypeScript you work. When you JavaScript you play. Experience matters.
What I like about TS is that it’s easy to adopt slowly. I didn’t have to learn any of the fancy features to get started - in fact I still haven’t learned a lot of it. Just adding basic types and classes and function type signatures has made the code more robust, quicker and easier to write and maintain, and it makes the code editor smarter as well. If I find the type system frustrating me in some way I can fall back to unknown and any - I’m not a perfectionist in that way :-)
When I see the title, I remembered this line from a song-
Translation:
Haha yes it's inspired from a Jayz song.