Skip to content

Instantly share code, notes, and snippets.

@amcdnl
Last active November 14, 2024 09:12
Show Gist options
  • Save amcdnl/b52e9dd11850eeb8de8f to your computer and use it in GitHub Desktop.
Save amcdnl/b52e9dd11850eeb8de8f to your computer and use it in GitHub Desktop.

Why I hate TypeScript

Warning: These views are highly oppinated and might have some slightly incorrect facts. My experience with typescript was about 2 weeks in Node and a week in angular2.

Not Standard

TypeScript is implementing their own take on JavaScript. Some of the things they are writing will likely never make it in an official ES* spec either.

Technologies that have competing spec / community driven development have a history of failing; take: Flash, SilverLight, CoffeeScript, the list goes on. If you have a large code base, picking TypeScript is something your going to be living with for a long time. I can take a bet in 3 years JavaScript will still be around without a doubt.

Its also worth noting that they have built some things like module system and as soon as the spec came out they ditched it and started using that. Have fun updating!

It should also be worth mentioning that this language has been around for a long time and only recently gotten popular because of Angular2.

Not Community Driven

There is no community really driving the language itself. From what I see, random new things end up there with little to no community feedback. I could be wrong here, but I just don't see it much.

Types in a non-typed language is hard

Its like trying to fit a square into a circle hole. A lot of the ES6/7 things I try to do don't work at all and will likely never work with the way some of the types work. I think it should be JS first and then types not the other way around.

It probably doesn't help that the main people that wrote this weren't big JavaScripters before they started but thats just my personal thought.

Babel is way better

Babel is the ****! The plugin architecture system is amazing idea! I love being able to get community driven plugins ( Even if they might not be standard thats the risk I accept and am ok with ). I can target multiple environments ( node 4,5 / browser ). Plus, they are implementing specs and even if they are stage-0 and change, they are atleast some spec and i can run that plugin until I can update too.

I've been watching some of the targeting issues and they are pretty far out, TS on Node seems like a great fit, why not get that going asap?!

Babel is just SOOO far ahead ... The fact that people are using Babel and TypeScript together is a huge flag that TS needs to up their game.

TypeScript Definitions

Um, why do I need to mock fake TSDs for things that aren't TypeScript!? Your creating more headache, work, etc. This should have been addressed in v0!

No idea what language features I can use

I hit this all the time, I had no idea what ES* features I could use and what I couldn't. I spoke about this on a issue and they said they are only doing stage-3 but they have other things that are stage-0?

They lie

I think I've heard about 100x you can use as much or as little of it you want. Ya, good luck. Having to put any everywhere is not my idea of that statement.

What about flow?

I do generally like the approach FlowType is taking.. they put JS first and then lay types on top. Also, I can use babel to compile it and its not as much of a plunge into a java/c# like language.

TS and Babel are doing similar type declaration syntax so its a safer bet that might be included in a upcoming spec and if it doesn't you can always use babel-remove-flow-types ;).

@khrome
Copy link

khrome commented Jun 2, 2023

Not specifically a criticism of Typescript, but everything that uses a babel pipeline has been a huge boondoggle (other than for app packaging), now that browsers finally have decent ES6 import support, it's amazing how few ES6 import codebases are actually import compatible and which wholly rely on transpile via babel and not actually are 1) importable themselves 2) have an import compatible dependency tree. instead of 1 migration... why not have 2?

Often TS maintainers only generate the dist artifacts on publish and do not document the various interfaces (babel rendered ES5, babel rendered ES6 + modules, commonjs, AMD - returnExports, etc) So I'm left trolling CDNs to find out which target I need and hoping the developer doesn't suddenly deprecate that target :P (it totally happens).

The "build 5 targets model" only further encourages fragmentation, when so much work was put into unifying codebases we're left with close-ish yet still incompatible junk by the powers that be. How much of everyday JS programmers jobs are normalizing between environments that the standards body's JOB was to make uniform? How much work are we doing to support code-time type hints for APIs we all should know?

It totally precludes buildless development. even if I want NOTHING to do with TS I need a build system to compile jsdoc to .d.ts (though this locks you to old versions because the jsdoc transformer has fallen out of date).

"But surely it saves us work... I can just use those types to push out wire formats (proto, thrift etc)"... well, no. "But it makes everything more secure by preventing type mismatches?" well, at the compile time it forces you to use it makes sure any of the linked code doesn't declare passing the wrong type (not the kind of security that makes you secure, but the type that can help not ship a broken build, AKA what tests already do). "Look dude, Typescript encourages adoption of modern standards right?" Not the actual ones that finally land, just a new language target invented by the maintainers and configurators of babel. In the end TS does 2 things really well: 1) provide type hints 2) serve as a transpile base for other meta languages to compile to (Google used this for Dart, MS for C#).

If your code fits those use cases by all means use it, but if you're in the vast majority of people using it on a small to medium sized project because you don't like to sit down and design your approach (and instead like to freeform select from dropdowns) and you don't like to write tests... deep inside you know what you're doing is wrong.

@eldoy
Copy link

eldoy commented Jun 2, 2023

Runtime typed function with VanillaJS concept (if you really have to).
Will throw error if wrong argument or return types, wrong number of arguments, etc... Would be very easy to add editor support for too.

let concat = fun('string', 'number', (a, b) => {
  return a + ' ' + b
}, 'string')

let result = concat('luv', 'js')

No need to invent a whole new language. This concept will even let you define your own types as functions so you can have an email type or a domain type or whatever. Max flex.

BTW, React, Svelte, and the lot, is 100% unnecessary. It's much easier to create components with regular template strings. No need for Babel or any lib at all really. It's the "blazingly" fastest too, and won't have a new syntax every week.

@beebase
Copy link

beebase commented Jun 2, 2023

With gpt assistants etc. coming up TS is even more pointless.

@jonlepage
Copy link

js rock !!!
ok then open you project with 250 modules.
Got to a ref with ~500 links, press F2 and rename.
Than cry and look your project destroyed.

Copy link

ghost commented Aug 11, 2023

TS is cancer.

@levancho
Copy link

TS is waist of time, I thought that it would be as pleasant of a language as actionscript 3/ ECMA 4, once was, but no it is mix little bit of everything.. I will not use typescript for my future projects anymore.. back to vanilla javascript for react and RN.

@jTiKey
Copy link

jTiKey commented Aug 14, 2023

I fight with the types more than I code. The console logs are just a wall of useless warnings for 10 rows about missing one comma. Everything is slow and laggy on an expensive laptop. The files are miles of code, it's always a maze to find what you need. I spend multiple more time on stuff I would do much quicker in js.

@nabato
Copy link

nabato commented Sep 1, 2023

"Types are worth of every additional hour you spend on them. There is no evidence, just believe me bro."

Several years later and my daily job is Clojure and it's a bless. But in rare times of frustration I visit this page to remind myself what a circus frontend development has been since TS introduction.

@mjobuda
Copy link

mjobuda commented Sep 1, 2023 via email

@milahu
Copy link

milahu commented Sep 2, 2023

I recently discovered that one could write js in a lispy way. Just use normal functions and call them ordinarily. [...] So why is nobody using it like that?

because javascript is not a functional language. javascript has no tail call recursion, so sooner or later you will hit the "maximum call stack size exceeded" error, and the function call overhead makes functional style slower and more memory-hungry than imperative style... but you can implement lazy functions and trampolines in javascript, and some functional languages are hosted on javascript, like clojurescript

@mjobuda
Copy link

mjobuda commented Sep 2, 2023 via email

@nabato
Copy link

nabato commented Sep 6, 2023

@mjobuda Don't listen to TS bigots. JS was planned as a Scheme in the browser. It was designed to be a modern functional language by its creator, but OOP fanboys disfigured it with Classes™ and Inheritance™.

@knightedcodemonkey
Copy link

Another popular web framework drops TS: hotwired/turbo#971

@jimmywarting
Copy link

All for it! 👍
but the way turbo went about it was a bit drastically. they could have done it more cleanly.

@tamtm
Copy link

tamtm commented Oct 22, 2023

@mjobuda Don't listen to TS bigots. JS was planned as a Scheme in the browser. It was designed to be a modern functional language by its creator, but OOP fanboys disfigured it with Classes™ and Inheritance™.

hell yeah, they can't handle javascript's prototype-based programming, so they have to add classes

@archcra
Copy link

archcra commented Oct 22, 2023 via email

@tamtm
Copy link

tamtm commented Oct 22, 2023

if you want to check types, just make a function to do it, there is no need for a whole language

@archcra
Copy link

archcra commented Dec 24, 2023 via email

@BeKnowDo
Copy link

Let’s be honest, TS advocates don’t really care about type safety. They just want their IDE to help them understand function signatures.

+1

@archcra
Copy link

archcra commented Apr 22, 2024 via email

@tetthys
Copy link

tetthys commented Jun 11, 2024

I like javascript not typescript.

@archcra
Copy link

archcra commented Jun 11, 2024 via email

@rhclayto
Copy link

It's built by Microsoft to fit the Microsoft way of development (big corporate teams). Good for them, & others like them. But then all the little open-source projects jump on the bandwagon, & then everything is in TypeScript, & the JS projects that are so useful to smaller developers wither away. So now we're all coding like corporate drones. It sucks.

@BeKnowDo
Copy link

BeKnowDo commented Oct 22, 2024 via email

@kevinlbatchelor
Copy link

I like that this conversation is still going after years, it speaks to, the fact that a vocal minority exists. However TS has won the day. I can, for the moment resist using TS, because I'm run my own teams. I believe the upside of using TS is outweighed by the downside, but most people are more concerned about their future job prospects and rightfully so. Lacking TS EXP will now affect your hireability, that is how software development demagogy works.

@desphilboy
Copy link

I like that this conversation is still going after years, it speaks to, the fact that a vocal minority exists. However TS has won the day. I can, for the moment resist using TS, because I'm run my own teams. I believe the upside of using TS is outweighed by the downside, but most people are more concerned about their future job prospects and rightfully so. Lacking TS EXP will now affect your hireability, that is how software development demagogy works.

It is winning because the world of development has been dominated by big techs more and more and they are enforcing it. As someone doing Typescript for 5 years definitely than lack of knowledge is not the motivation for me

@BeKnowDo
Copy link

I'll continue to say this. The only reason why TypeScript has grown in popularity is because a very big company pushed it onto everyone.
I'll take three senior javascript developers and match them up against any three TS developers and we'll not only get things done faster, it'll have just a few bugs. TS doesn't make you a better engineer or developer.

@nabato
Copy link

nabato commented Oct 24, 2024

I'll continue to say this. The only reason why TypeScript has grown in popularity is because a very big company pushed it onto everyone. I'll take three senior javascript developers and match them up against any three TS developers and we'll not only get things done faster, it'll have just a few bugs. TS doesn't make you a better engineer or developer.

Exactly this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment