7 really good reasons not to use TypeScript

Everyone loves TypeScript. It “solves” many problems JS has, it is a “superset” of JS, it will make your code error-prone and pleasant to read. There are a lot of good reasons to use TypeScript, but I am going to give you 7 really good reasons not to.

It is risky

Wow. How can it be risky, if TypeScript adds type definitions and checks them at compile time? As well as IDE integration will warn you about any type mismatches? Exactly because of that. TypeScript will only check types at compile time and only types that are available. Any network calls, system libraries, platform-specific APIs and non-typed third-party libraries have no way of communicating with TypeScript. As you get used to having your types checked and not having to fully understand the code and the platform, errors and bugs will manifest themselves.

With JS, you make no assumptions about types, and you check the concrete value of the variable to make sure it is what you expect it to be. Or, if you do not care about its type in this particular case, you do not. In TS, you rely on the compiler to do it for you, but it can only check so much. You can combine the two ways, but what is the point then? If you will spend time writing definitions and then spend time writing code to ensure these definitions are maintained during runtime, why have them in the first place?

It is messy

Another paradox: the language that was supposed to bring clarity and readability to the codebase obscures it instead. To show you what I mean, check out some of these examples I found in popular open-source libraries:

This one is from the Redux library, and all these 4 lines do is assign nextReducer to currentReducer.

Next example if from the RxJS library. I do not know about you, but if I have to fight a tool that is supposed to help me, I do not think this is a good tool.

It does not solve the problem

TypeScript is said to solve JavaScript’s problems. But it does not. Dynamic typing was never a problem in JavaScript, but many other gotchas such as NaN === NaN being false, semicolons being optional or not optional, a linebreak changing an object definition into a scope, syntactic sugar in place of OOP are indeed problems. TypeScript does nothing to solve them, but introduces yet another standard, further polarizing the JS community.

Even under the assumption that the lack of typing in JS is a problem, TS does not solve it. Do you know what does? Java, C, C# and other compiled languages. They can safely guarantee strong typing at compile time and runtime. Interpreted languages are just not capable of it.

It is not a superset, it is a subset

TypeScript is something that compiles into JavaScript, it cannot be a superset by definition. It limits what you can do with JavaScript and obscures its strong sides while providing a fake peace of mind. If you really want to be a great developer, do not settle for a comforting lie and try to understand the true power of JavaScript and its flexibility.

It is open-source, but nothing more

Many reasons for using TypeScript state that it is open-source. That is true, TS compiler is distributed under MIT license. But it is still controlled by Microsoft, a giant monopolistic corporation, and its open-source advancements are nothing but a marketing move. Do not confuse open-source with democracy: Microsoft is still free to do anything you want with TS, and you are just here to watch. JS, on the other hand, is governed by an international committee and will not change anything without the community’s approval.

But big companies use it…

I cannot believe that some people consider this a reason. Big companies also use legacy codebases, commit tax frauds and discriminate against women. Why all of a sudden them using TypeScript is a good example?

But it has more features…

Not anymore. True, when TS was first introduced in 2012, it had features like classes, still not available in JS. But JS had come a long way since then, and now TS is struggling to keep up. If there is anything missing in JS, there is a babel plugin to do it.

Thank you for reading, I hope you liked this article! For more info about advanced concepts in JavaScript check out my other posts:

Get new content delivered to your mailbox:

40 comments

  1. rob | may 25, 2020

    Interesting article. Thanks for sharing!

  2. johnny | may 31, 2020

    Really good article. I think Typescript had a reason to exist when it was created 2012. Nowadays, it is true that it offers fewer advantages, we deserve a better alternative but… it’s a religion in hype.

  3. xenock | june 24, 2020

    Thanks to god! There are some people thinking as me.
    I am agree with all of your arguments, and think as Johnny too: “It’s a religion like”

  4. matt | july 3, 2020

    This seems like a pretty biased article to me.

    Risky? It’s meant to be a help you catch some things earlier, it should not replace your tests which should catch issues whether using JS or TS

    Messy? It can be used in a way that is pretty visually verbose e.g. in a complex library. This is generally to give user of the library and the IDE a more discoverable and informative experience when using the library. Actually using it in your application, it is often very clean syntactically and at a glance describes what something is.

    Doesn’t solve the problem? Humans are the ones writing JS. It is very easy during development of an application that you miss something innocuous which causes a runtime error. Risk of this is dramatically increased if refactoring a large project with similar named code structures. So it goes a long way to reducing human mistakes from dynamic typing

    It’s not a superset, it’s a subset? Same point as above, humans are the subject here, not Typescript itself. It allows humans to state and enforce a super set of functionality like abstract classes and methods, JS adds and is planning to add some of this into JS which is great and ideal. But in terms of the code written and delivered, it offers a superset of ways to write code that does exactly what you intend and can’t be written in the wrong way (by another developer)

    But big companies use it? They often have high standards, have the goal of making money and want to use the best technology available. It surely lends some credibility to TS that hugely successful tech companies see the advantages.

    If you are responsible for a large project with multiple developers where you want to continuously want to refactor it by applying your latest knowledge to have the best platform it can be – you can easily see the value it offers.

    Team members can share explicit definitions of their code with others. This is great for other develops as the code becomes much more discoverable and you have reduced their ability to cause unintended problems using your code via strict type annotation.

    You can also refactor with confidence, personally I have done Ctrl+F replaces when I have accidentally changed the name of a variable with a similar but different name. Typescript flags this in the IDE, giving you much more confidence and increasing the quality of your code.

    Why might not want to use it:
    – Rapid prototyping
    – Easier debugging via straight JS
    – Straight JS may have better performance since you explicitly structure your code compared to whatever Typescript generates.

    There are reasons to use it and not to use it but it’s a balance. All or nothing one way or the other is self defeating

    • michael krasnov | july 6, 2020

      Yes, I agree it is biased (after all, I post my personal view on the matters on this blog). And I am not saying you cannot make TypeScript work. What I mean is that this is not a solution for the inherent JS problems, and it is possible to create a sound codebase without depending on TypeScript. As for the big companies, do they really produce quality software? I mean, TypeScript is from the same company that wrote Windows, and while Windows is very robust and gets work done, I would never go as far as suggest it works as good and as predictable as Linux/macOS

  5. There’s so many more reasons that that.

    I can’t think of any reason TO use TypeScript. It’s demonstrates a fundamental misunderstanding of programming to purposefully “convert” a loosely typed language into a strongly typed ones. As if the open community of computer scientists that are responsible for the evolution of JavaScript just keep just “forgetting” to add types to their loosely typed, dynamic language.

    What is the practical difference between a double and a float type in C? The answer to that question is the original reason for using types, and it’s something that JavaScript developers, thankfully, do not need to worry about.

    Not to mention that it is not compiled, it’s transpiled. It’s converting one language into another one. What you end up with is still JavaScript – it’s just JavaScript written by an algorithm with a whole bunch of polyfill and/or other unnecessary bloat inserted in order to accommodate the programmer (as opposed to accommodate the solution to the problem). This is the wrong tool for any job and especially any job that is performance sensitive.

    Good programmers should know more than one language and be comfortable with multiple programming paradigms. If you need TypeScript in order to feel comfortable with your code base, that problem exists between the chair and the keyboard.

    The ultimate sophistication is simplicity. TypeScript is a huge swing and miss from the corporation that also bought the web Internet Explorer and Silverlight. Why would anyone want to insert a layer of complexity into their build process in order to program in a different language than the one natively interpreted by the client? It seems so ridiculous I can’t believe it’s so popular. I would pass, but unfortunately it seems it’s so hot right now with hipster front-end developers, I’ve got no choice but to use it.

  6. The thesis of this post seems to be: “Typescript doesn’t solve every problem, so don’t use it.” I mean, no technology solves _every_ problem, but Typescript prevents a whole heck of a lot of bugs in my experience. And thus should be used in most JS circumstance while — as with any technology — understanding its limitations. It’s one more tool in the quality arsenal. Alongside unit testing and, of course, thoughtful software design.

    • michael krasnov | august 31, 2020

      What I meant to say is “typescript does not solve JS problems but creates new ones, so don’t use it”. Carefully designed JS code prevents a lot of bugs in my experience, and TS will just mitigate the symptoms of a rotten codebase for a while, but will not make the problems go away, as it is no substitute for clean code.

  7. george j beier | september 10, 2020

    Sure wish they’d just add types to js itself. “let int x = 3” or something like that. Would sure solve a lot of problems.

  8. This is a brave article; very courageous to put your views out there like this, knowing the combative responses and disagreements you’re inevitably going to have to face. I appreciated the article. It was a fun read and had some good points. And I must agree, I can’t see even a halfway-decent reason to write in TypeScript. I’ve searched high and low, and that’s even one of the reasons I found your article to begin with: searching for a reason to use it. But all I’ve found is very clearly dumb opinions and faulty appraisals.

    There’s this weird thing I see all the time in the opinions of TypeScript users, which is that they feel it’s a great, clear improvement over ECMAScript, but then they say stuff that proves, in detail, that they don’t understand ES or loosely-typed functional programming very well. They make comments and describe concepts that just don’t make any sense to those who have a sound education in ES. They talk about it like it needs more data types, like an old strongly-typed language from the 1970s, as though there isn’t a great reason NOT to have more data types.

    So as far as I understand it, TypeScript solves a problem that ES writers should not have. And for those who DO have that problem, the real problem seems to be that they have the wrong idea about how to write ES. They see TypeScript as a solution because they write in a style where it becomes a solution to the problems they are having, but if they used the language as it should ideally be used, they wouldn’t even have personal experience with those problems to begin with.

    It’s really hard to explain this stuff to people who like TypeScript. It’s like explaining to Java or C# writers that they don’t need to use classes in ES, and that by using classes in ES, they’re just wasting their time enormously. People who have that mentality just think it’s what has to be done. And people who love strong typing seem to be the same way. It’s very difficult to convince them that they’re only hurting themselves by trying to enforce additional data types in a language that was designed to be used without them.

  9. How can typescript be a superset of JS if it just breaks some aspects and essence of the of the language itself? TS is nonsense and makes lazy programmers for JS env. While it surelly gives some help for ppl using code in finding parameters and there respective ‘types’, I don’t like this. There are reasons why ECMA don’t officialize types in a dynamic typed language.

  10. Very well said. I’ve never been a fan of Typescript, Adobe’s strongly typed ecmascript based AS3 implementation however, was excellent in comparison.

  11. Great article. as a front end developer for 10+ years Typescript is the worst thing ever invented.
    They try to change this beautiful language, and it’s very sad that new developers learn only Typescript and have no idea how to use Javascript.
    Companies depend too much with it, a good developer that is in control of his code doesn’t need it, and it will soon leave this world I’m sure.

  12. Glad that there are some ppl that thinks typescript can be an overhead and see it as a burden.

    jsdoc, default arguments, async and // @ts-check goes a long way with doing typing without typescript.

    TypeScript adds an overhead. makes the project bigger, will always be in the shadow of the next version of JS and have to keep up with all new changes + it don’t “actually” run anywhere without being transpiled to js in the first place. so you can’t import only the necessary source file in the browser without having to include the hole compiled bundle.
    I like build-less toolchain where it can run directly in the browser. I only mostly do minification at the deploy stage. saves me quite a bit of time.

    it honestly feels like typescript is trying to fit a square into a circle and invading our beloved dynamic typed javascript place.

  13. karl morrison | october 30, 2020

    I’ve personally seen TypeScript make developers more lazy, they rely too much on it which leads to worse understanding of the code, worse understanding means writing worse code. I only like one thing from TypeScript and that is seeing types defined on parameters, but JSDoc already fixes this issue. TypeScript also happens to strangle JavaScripts into this rigid non-dynamic code. Don’t get me started on the misleading error messages and bugs also.

    TypeScript is a bad implementation of type safety in a language which should never should of been statically typed.

    What people should be focusing on are tests… tests tests tests. TypeScript will never save you at runtime.

  14. victor herman | november 3, 2020

    thank God that at least someone had the balls to say it. Just give it sone more time to follow on the coffeescript steps

  15. sonya bardell | november 23, 2020

    It is too risky: io-ts, runtypes and other libraries bridge runtime type validation with Typescript’s static type checker.

    It is messy: Any code can be messy, cherry picking awkward examples doesnt say much. Also be mindful that awkward written JavaScript may result in awkward TypeScript definitions trying to map it. Summary, fix your JavaScript.

    It does not solve the problem: JavaScript does indeed have many problems. TypeScript solves a great many of them through excellent tooling. TypeScript can assert the interior of your codebase is sound (if you write sensible code the complier can assert), for exterior io interactions. See io-ts or similar.

    It is not a superset, it is a subset: It’s sharing 99.99% parity with JavaScript. While not strictly a superset, its so inline with vanilla JavaScript, the disparities are so niche, the majority of developers would be hard pressed to find them.

    It is open source but nothing more: Did you expect something else? Also, what’s with the Microsoft bashing. It’s not 1999 anymore. There are far bigger and user hostile monopolies to worry about these days.

    But big companies use it: Indeed, and big companies have big codebases and big teams that need to coordinate around those big codebases. TypeScript provides adequate tooling that JSDoc comments and poorly written JavaScript documentation dont.

    But it has more features: It has no more features than JavaScript, not should it. Early revisions of the compiler had class syntax and ESM-ish module imports before JavaScript. The compiler needed to map to a variety of module systems for it to be useful, and it did so with a unified import/export syntax we take for granted today. The only significant feature TypeScript has that JavaScript doesn’t (other than a amazingly flexible, next gen type system) is enums.

    TypeScript is an astonishing language. The sophistication of its type system has progressed to the point where not only is it able to map to pretty much every quirky JavaScript pattern, it’s become programmable to the point you can write language parsers with it (see ts-sql).

    I wouldn’t write off TypeScript, above and beyond JavaScript, the language is doing innovative things that may not be obvious at first glance. Ironic in a way, as many of these innovations seem a direct result of staying ruthlessly true to JavaScript. Go figure.

  16. Thank God for an article that shows typescript for what it actually is. It’s for an*l back end developers who think they are full-stack because they learnt some js/react. The same ones who can’t stand that JS is loosely typed and that variables don’t need their types defining.

  17. I hate JS stack…if someone finds it offensive should look elsewhere because they’re not the creator or take that insult personally.

    I like web assembly because you can work on a single language and WASM is supported by all the browsers. Even Apple (ah another culprit who destroyed good plugin base stack) is onboard. Blazor looks good but microsoft has to iron out few things e.g. AOT lined up for the .Net 6 release with few other enhancements.

    Google got flutter but it is mainly a mobile development platform (web support is weak in terms of UI component libraries for web).

    Adobe actionscript & flex (mxml markup) were pretty good SPA platforms (really enjoyed it but apple killed it). Still wondering if WASM was available and they can convert the actionscript and flex mxml to WASM.

  18. kirby wallace | january 27, 2021

    I understood the value of typescript prior to ES6, but once ES6 introduced classes natively in the language, there went a major part of TypeScript’s advantage right out the window. But with native support for classes in the language, what TypeScript gives us now is two competing methods for doing the same thing. Redundancy.

    I too would like to see type declarations for function parameters, but not at this cost.

  19. christoph wolf | february 2, 2021

    funny how that typescript code just shows more documentation. I just don’t want to fly blind when I code and not have to look up every github page or library or whatever to figure out what the hell is inside this object. strongly typed languages got that figured out. they don’t want to search all the time. they want you to properly sign your obejcts and methods and then your done! DO THIS JOB ONCE SO NOBODY ELSE HAS TO ANYMORE is the slogan. I’m already sick of JS because of this BS.

  20. christoph wolf | february 2, 2021

    in addition to what i just wrote. react is doing the best with what js is providing them. literally nothing. that’s why they have to come of with this mess of a method signature. go learn C# or Java if you ever want to see real strongly typed languages…

  21. christopher franko | march 7, 2021

    And just like that. Im not longer alone. I hate TS.

  22. a name | march 23, 2021

    Wow, this article is a sack of bullocks.

    I’m not going into the details, because most of the people already explained it, but no. 6 is especially cringy – you’re bringing up someone’s argument for using typescript, present a counter-argument and then pose it as an argument for not using typescript. That is some serious logic fornication, my lad

  23. dude | april 1, 2021

    I love this article. I totally agree. I’d like to add one more simple reason. TypeScript makes a simple problem too complex unnecessarily. Simply the code shows it. I don’t understand why many dumb assholes of mt.stupid level on Dunning–Kruger effect back the garbage up as the industry standard. What the f*ck is happenning in the software industry? I say the rich gurus are dead with their money throwing their leadership and philosophy to the waste bin. They don’t have time to educate the mt.stupid levels because they have to enjoy the rest of their life with their money. I hate this situation.

  24. dude | april 1, 2021

    Is there anything of which one can say, “Look! This is something new”? It was here already, long ago; it was here before our time. – Ecclesiastes 1:10

    Exactly this is happening in the software industry. Tons of intellectual gurus made a lot of great things already in the history but I see many naive mt.stupid levels in many big companies are too ambitious to repeat unnecessary jobs in downgraded way. They never learn from the history. Because they never respect the history. They believe they can make the better result without knowing the history, without any wisdoms. But the industry already has been messed up.

    “If you can’t explain it simply, you don’t understand it well enough.” – Albert Einstein

  25. thomas mowry | april 11, 2021

    TypeScript is a bloated annotation framework. Its MS second attempt to control javascript. Its JScript 2.0 The basics of what it tries to achieve could be achieved by a better version of JSDoc or a new annotation framework via code comments. WHY DID they ever introduce classes into the JS core language???? A prototype language?? You can fake a class system/library with the core Object functionality (take a hint from Smalltalk). A transpilers should never be a part of you core design process (I can understand existing code). Look into dynamic meta programming instead. The originators put Java in the name purely for marketing reasons. Not so 20 years later it could morph into a shittier version of a shittier version (self/java) of Smalltalk. Unfortunately, TypeScript and Javascript have so much momentum we will be forced to work with them until the sun consumes us.

  26. hayden pennington | april 14, 2021

    Your arguments are really weak.

    Big corporations are risk adverse and are slow to adapt programming languages. Usually ones that are battle tested and large in the market. This means there are jobs, which is a great reason to use a language.

  27. hayden pennington | april 14, 2021

    Also, the idea that a typed language means you don’t have to understand the codebase is nonsense

  28. james auble | april 22, 2021

    I love brutal articles like this lol.

  29. raisinbagel | april 28, 2021

    As part of looking busy on the bench, I recently finished a Udemy course on Kotlin, and just now finished a really long tutorial on TypeScript. There was a surprising amount of overlap in features, but I cannot say they generated an equal amount of enthusiasm from me.

    Kotlin was a blast. My impression was, “whoever wrote this has done a pretty good job cherry-picking the best language features and leaving out the worst.” Not to mention the balance between succinct syntax and readability. That was done really really well. At one point, I found myself googling whether there were plans to port React and Redux to Kotlin on my phone, while I waited in line for my covid shot. Yes, there are.

    On the other hand, when I finished TypeScript on the other hand, which I am only learning for employability purposes, the very first thing I clicked after downloading my worthless completion certificate was this article.

    I do think TypeScript has value, for big projects that happen to have some very dumb coders, it is a way of forcing them to interact with your code in a way you intended. I also disagree with the “makes lazy” arguments above, because it seems to me that TypeScript is the type of thing that would excite the kind of people who hold on to receipts, and have beautiful super-organized binders from every college class they ever took still on their bookshelf 10 years later. And, I thought some TypeScript features were kind of cool, like decorators and abstract classes. But that is as far as my praise goes. Overall, it feels like a lot of extra work to avoid mistakes that wouldn’t be made if people took pride in their work.

  30. cameron | may 28, 2021

    Great article, good comments but if not TypeScript to help with some of the runtime errors caused by types what is the alternative?

  31. Thank you for this article. Since i learned of TS I always thought there was something deeply wrong about it. Among other things the one I hate the most is that it becomes quickly incredibly hard to read, I mean JS can get messy but when you add TS in the mix it becomes ridiculous. Bending a dynamic type language in the shape of a static one is the wrong answer to a barely existing problem. Just to make a point, imagine a TS for python and your inner laugh will answer to any doubts you might have harboured until now.
    If anything I would add type hints to JS and that would be more than enough to add some clarity to the code when needed .

  32. tarik boschi | june 26, 2021

    TS is more intuitive and helps with typing errors and parameters. lol
    See the example of using the Image component of NextJS

    Error:

    Type ‘{ src: string; alt:string; }’ is not assignable to type ‘IntrinsicAttributes & ImageProps’.
    Type ‘{ src: string; alt:string; }’ is not assignable to type ‘ObjectImageProps’.
    Types of property ‘src’ are incompatible.
    Type ‘string’ is not assignable to type ‘StaticImport’.ts(2322)

    Correction, add image dimensions as described in TS error message. lol

    TS for me honestly is not worth the extra effort of settings…

    JS is love.

  33. bryan price | june 29, 2021

    I quickly gave up on TS when I spent more time debugging typescript issues than my own application code. total waste of time and overhead. I found it useful for exploring large codebases of open source projects and autocomplete on my own. If you want autocomplete use JSdocs.

  34. morgan | july 9, 2021

    I like TS because it makes my diffs larger when I open pull requests, so I look like I’m doing a lot of work.

    Otherwise it is an abomination.

  35. omizzy | july 16, 2021

    Typescript is total hype of corporate tech development, I spend more time debugging to make typescript happy than actually debugging code. Granted we need types but as an integral part of the language not as another layer to JS. Total bullshit in my opinion, JS is great for rapid development and shipping, TS is not — my opinion, not fact!

  36. alexander vu | july 24, 2021

    A great article. It absolutely describes my experience with Typescript. I work for the “big companies” with a user base of 60 M and Typescript has brought us CONSIDERABLY more work with a CONSIDERABLE restriction of the possibilities. The benefit is incredibly small. This is my experience with the use of typescript after 6 years and a team of over 100 people.

leave a comment