DEV Community 👩‍💻👨‍💻

Cover image for I’ve Got 99 Problems but Learning TypeScript Ain’t One

Posted on

I’ve Got 99 Problems but Learning TypeScript Ain’t One

Why have all JavaScript developers not moved to TypeScript?

I asked this question on Twitter last week and got ~100 replies.

To all JavaScript developers who have not moved to TypeScript — Why?

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.


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.

Top comments (47)

jonrandy profile image
Jon Randy 🎖️ • Edited on


Because I don't want to give up the freedom and speed that not having strict types gives you. Seriously, I used strictly typed languages a lot before coming to languages like JS... and they feel so utterly restrictive in comparison.

Why anyone would prefer strict types is beyond me

stojakovic99 profile image
Nikola Stojaković • Edited on

And as someone who worked extensively on dynamic typed code bases I have an opposite question - why would anyone prefer dynamic typed languages on anything bigger than a small hobby project?

I prefer static typed languages because:

  • I can focus on my work instead of worrying about possible runtime issues caused by trying to access null object or implicit coercion happening when I don't want it (yes, you need additional validation layer for input data but nowadays you have class-validator and similar libraries for that purpose so you can validate input data right away).
  • Algebraic data types (which are supported by TS) allow me to easily model my business rules and, with the help of compiler, ensure that I'm following that rules everywhere.
  • Code is self documenting. I don't need to use JSDoc or annotate my code with Flow (yuck) to know what's happening one year later. It's right there in the code.

I keep hearing this argument that static typed languages are slow to work with - it is slow at the start but saves you time in the long run. For example, I worked on Rails code bases - good luck trying to guess what magical trick Rails pulled which caused something you wrote to work in a completely different way than you thought about it.

We see that more and more languages are adopting type annotations (Ruby with RBS, Python and PHP with type hinting, even ECMAScript is in the process of adopting type annotations etc). There is a reason why we don't have many enterprise applications written in Django or Rails but rather in ASP.NET or Spring. Types matter.

t0nyba11 profile image
Tony B • Edited on

I prefer JS over TS from a cost/benefit perspective personally, but strict types have one huge advantage - security.

Unless you want to be checking the types of every parameter in every user-called API and piece of data moving around, you will always feel a little exposed to DoS attacks, path traversal exploits, authorization issues, etc.

Security is really the only reason to use TS IMHO. If you don't have security concerns, and aren't working on anything "serious", I wouldn't bother with it.

castarco profile image
Andrés Correa Casablanca

I'm not trying to change your mind with my response, but I believe that your take on how typing works on TypeScript might be misguided:

  1. It's not really strictly typed, we have very vague types, such as unknown, any, or {} (although it is more strictly typed than, say, Python).
  2. The way it works with types is much more flexible than what we can usually find in languages such as Java or C++, as typing in TS is not "nominal", but "structural".
  3. On top of that, features such as "union types", "conditional types", and "mapped types" (which usually don't exist in traditional imperative typed languages) create a huge difference in flexibility and expressiveness.

Now, on the "why anyone would prefer strict types", well, there are plenty of informed reasons for that, the following list is not exclusive:

  1. They reduce the amount of logic errors in our code. For example, they make it easier to implement techniques such as "making illegal state unrepresentable". But of course they go further than just allowing this.
  2. They act as documentation.
  3. They make it easier for autocomplete/intellisense features to work properly and much better than in strictly dynamic languages.
  4. They act as a very powerful aid for people with attention problems, such as ADHDers.
jonrandy profile image
Jon Randy 🎖️ • Edited on

Note that my original comment is really in response to the tweet, not the article heading.

I understand very much how it works, and have used it. It just really rubs me the wrong way and takes all the joy out of working with JS

Thread Thread
darkyelox profile image

The joy you talk may be good for small or micro projects like a simple web page, an small libraries and so but for big projects were many people is involved it may be a big problem for everyone working in the same codebase, trust me I have suffer so much with enterprise projects working with bare JavaScript and tons of undocumented and random objects with random properties. My point is I know what you mean but it depends of the kind of project, is only my advice.

codewithvoid profile image

So you like JS as is 🙂.

Thanks for sharing!

jareechang profile image
Jerry • Edited on

There are plenty of reasons to prefer strict types:

  • Defining strict contracts in your inputs and outputs (ie this function takes in string return a string etc)

  • Reducing run time issues (type checker will make your code fufill those contracts)

  • No more typeof arg === <type> logic

  • Editor autocompletion and reference

Is it better for a small team ?

Probably not... if you have a small codebase and you are only one working on it then it might not be that helpful.

Where it shines is large teams (5+ people) working on same codebase.

mrwensveen profile image
Matthijs Wensveen

I think TS solves a lot of what people consider to be restrictions by having very powerful type inference. This means that you usually don't have to define your object types or return types upfront. I often don't like the boilerplate of statically typed languages, but I don't have this problem with TS at all.

brense profile image
Rense Bakker

In my personal experience, devs who refuse to learn typescript don't understand the meaning of the words: "it's a superset of JavaScript". It really quite literally is just JavaScript with type safety. Nothing more, nothing less. It doesn't add any other functionality beyond that and that decision was made on purpose. Some developers however are so religious, that they will dismiss anything beyond what they're already doing.

miketalbot profile image
Mike Talbot ⭐

I learned it, I don't like it, I've gone back to JS in which I am significantly more productive. That's unless I have to use it for some project in which case, its fine. I prefer to document my functions with JSDoc because that's more useful than types alone and less effort.

brense profile image
Rense Bakker

Thank you for proving my point that you dont understand what superset means 🤦

Thread Thread
miketalbot profile image
Mike Talbot ⭐ • Edited on

LOL, if you really think this proves that point then you are really confused. In order to use the additional features one needs to define types, defining types is additional work that I find pointless and wasteful in most circumstances - therefore I do not use this feature of the superset. I do allow typescript compiler to read my JS as of course that helps with intellisense, but by not bothering to try to convince the compiler I know what I'm doing I save effort and end up with easier to read code that works just fine.

In the past it was the case that TypeScript allowed the use of more modern JS constructs, but Babel and the advancement of browsers has rendered that set of really quite useful superset features irrelevant.

jarrodhroberson profile image
Jarrod Roberson

by your logic, then why does anyone use C anymore, C++ is a "superset of C", as is Objective-C and a few other languages that add stuff to C.

Making them NOT C. Adding the typesafe changes the contracts of the language and syntax in a way that makes it NOT JavaScript in the same way C++ does to C.

C++ started out as pre-processor extension that transpiled down to C, sound familiar?

Whatever point you are trying to make that Typescript is JavaScript with stuff added is just proving why it is not used.

crowdozer profile image

I put it off for a long time because it looked hard to learn. Brackets in function definitions? ".d.ts" files? Wtf? It looked like it would be a lot of overhead, a lot of configuration, lots to think about...

In reality, it was really easy and only required a few quick searches to figure out some of the jargon. Most of TS comes naturally I feel lol.

It made me a lot more productive and comfortable. I really don't understand the view that TS slows you down or that it's overkill for front end projects which seems to be a fairly common view. Maybe I'm just "doing it wrong" but it really doesn't take that long to set up and configure, even defining really complex types only takes a moment. I could see it being overkill if your app isn't that data driven, like if all you had was a blog or something. But a CMS or something with complex business logic definitely benefits from TS.

I appreciate that it's totally configurable as opt-in. For those situations where the type isn't actually that important, or you're working with vanilla js code, I can always just tell the compiler to allow js files, allow implicit any, or don't and slap an :any on something explicitly. It's not black or white, all or none, you know? I like that.

It's funny, PHP's typing made TS's typing feel natural to me, but going back to a PHP project, it makes me wish they supported more of TS's features. Oh, this function returns an array? an array of what? you can't tell me? 😛

oriongunning profile image
Orion Gunning

I totally relate, after using typescript on a project recently, you quickly start to enjoy knwoing exactly what is being returned :)

jmfayard profile image
Jean-Michel Fayard 🇫🇷🇩🇪🇬🇧🇪🇸🇨🇴 • Edited on

There is a saying that "practice makes everything perfect" and I vehemently disagree with it. What is true is that "practice makes everything permanent".

Whether the things you permanently learn are good or bad on the long term is the responsibility of your teacher. Or yours if you don't have one. A good teacher will insist that you learn the "basics" right. Like when I learned to dance tango, they insisted for months and years that I learned to walk correctly, tango style. Not to do things that impress people that know nothing about the dance. This was annoying but it was right.

What you call the basics is in fact your foundation. Learn the right things like static typing and unit tests and you will have the right foundation.

Don't do that, and well, do you remember what they say about houses you build on sand? It is much harder than you think to unlearn the bad practices once they have solidified in your head.

jarrodhroberson profile image
Jarrod Roberson

one of my most insightful friends used to have a saying "hanging by your thumbs is easy once you get used to it" ...

crowdozer profile image

"practice doesn't make perfect, practice makes permanent."

I like that 😛

cicirello profile image
Vincent A. Cicirello

Very well said. I especially like the "practice makes... permanent" part, as well as the importance of building a solid foundation.

j471n profile image
Jatin Sharma • Edited on

I used to think that why would I learn Typescript when I can do everything with JavaScript. About 2 month ago I was just going through typescript's docs and i mind was 🤯 with so many things such as generics, interface, etc.

Learning typescript is not that hard. Using it could depend on your project. If your project is small like 2-5 pages then go with JS on the other hand if it's big then i would recommend using typescript.

Typescript is very useful for open source project. And it's up to you to use it. No one is forcing you.

BTW I am writing an article to explain Typescript's most of the topics with some great example. You can follow me for that (Shameless Plugin)

leob profile image

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.

raibtoffoletto profile image
Raí B. Toffoletto

Sometimes I use JS, sometimes TS... I write TS thinking of JS and JS thinking in TS. You can write both clean or spaghetti code in both languages. Use what makes sense to you and the project. For example if you're mixing those with PHP or C# having to set the TS tooling may not make much sense. For my personal projects nowadays I will always go for TS. But I agree with noobies, master JS first and maybe another Static typed language... then TS will feel natural.

j471n profile image
Jatin Sharma

When I see the title, I remembered this line from a song-

I got 99 problems Honday oday ch plus tere nakhray ney tin so


I got 99 problems, they are bases plus your acts are 300 (shot towards a girl).

codewithvoid profile image

Haha yes it's inspired from a Jayz song.

imthedeveloper profile image

I've been back and forth a few times mainly due to legacy projects running plain js

One thing that hits me every time I go back to ts is my brain melt down of how to structure files and the project to best use the types I've defined (separate type files or interfaces to share)

I'm positive by reading over other people's projects I'll pick that up easy enough but I feel like I drop right into that swirl we all used to have with the "how do I structure my js project" but now there's these new files I want to be mindful of.

fyodorio profile image

When you TypeScript you work. When you JavaScript you play. Experience matters.

liz_flem profile image
Liz Flemmings

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)

jjstrat3 profile image

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.

kgilpin profile image
Kevin Gilpin

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 :-)

liftoffstudios profile image
Liftoff Studios

JS rn is works well enough for me
Havent felt the need to learn TS yet

amm834 profile image
Aung Myat Moe

Typescript is safe for runtime?

Let's Get Hacking

Join the DEV x Linode Hackathon 2022 and use your ingenuity and creativity to build using Linode.

Join the Hackathon <-