DEV Community

Cover image for This is why I hate Typescript
Michael De Abreu
Michael De Abreu

Posted on • Updated on

This is why I hate Typescript

This a satire post about some arguments that you can actually find against Typescript. Through most of them are being exaggerated, they all represent an opinion of one or several people.

Typescript is not standard

Typescript is just a big amount of garbage on top of the most wonderful language on ever created, JavaScript, and it's not even trying to follow the standard of JS. I will give you examples of how TS does not follow ES standards.

Modules

TS has its own module system, called namespace. What is a namespace you may ask? It's a thing that Microsoft invented to totally ignore ES standards modules. I doesn't matter that ES6 modules wasn't really defined when TS was first announced, Microsoft should have know! Also, I don't care if TS now support ES modules, namespaces should have never existed and they should disappear!

Classes

Much like TS have namespaces, they have their own way to declare a class.

A class in Typescript:

class Foo {
  bar = 0;
  baz = 0;
}
Enter fullscreen mode Exit fullscreen mode

A class in Javascript:

function Foo() {
  this.bar = 0;
  this.baz = 0;
}
Enter fullscreen mode Exit fullscreen mode

And you may argument that I'm writing ES5 style classes, but even with ES2015, JS looks much better!

class Foo {
  constructor() {
    this.bar = 0;
    this.baz = 0;
  }
}
Enter fullscreen mode Exit fullscreen mode

You can also say that when TS introduced classes, the JS classes proposal wasn't defined, sure. But why they are using class field declarations? They are not standard! (Yet).

Private properties

Well, JS does not have private members, but when it does, it will be something like:

class Foo {
  constructor() {
    this.#bar = 0;
  }
}
Enter fullscreen mode Exit fullscreen mode

Now, TS does support for privare members, but how does it looks in Microsoft language?

class Foo {
  private bar = 0;
}
Enter fullscreen mode Exit fullscreen mode

Ugly! And they are not even working on it! Aren't they? Like this wasn't enough, "private" members in TS are not really private, as you can access them with bracket syntax!

Typescript is not JavaScript

Take any current ES code and try to compile it with a fresh new TS project. You won't be able to do it. Because Typescript is not JavaScript! Not even a simple factorial function.

In JS:

function factorial (n) { 
  if (n == 0) return 1;

  return n * factorial (n-1); 
}
Enter fullscreen mode Exit fullscreen mode

In TS:

function factorial (n) { 
  if (n == 0) return 1;

  return n * factorial (n-1); 
}
Enter fullscreen mode Exit fullscreen mode

You now have two errors because TS can't understand what you are doing. You have to write in a syntax Typescript understand.

function factorial (n: number): number { 
  if (n == 0) return 1;

  return n * factorial (n-1); 
}
Enter fullscreen mode Exit fullscreen mode

There you have it TS! Now you, and most likely any other person in the world reading only the signature, will know what the function is supposed to return, and what the argument type supposed to be. I don't want to write that. Why TS can't understand that I'm returning the same function that will eventually return a number? Besides, if I want someone else to understand my code, I'll comment it, or add unit testing. That's what you need for anyone to understand the code. Beside, that's an elemental function, what needs to be explained any way? You can't be so ignorant to not know what a funcional recursive pure function does!

And you may say that I have to change the compiler options, and disable implicit any for this error to go away. But I would like better for TS to understand my code.

The creator of Typescript knows nothing about programming

I will start that Microsoft is the father of all evils, and Typescript was created by Microsoft. It does not follow any standard as I explained above, and only was created to extinguish the web development as we know it. Always remember the Microsoft moto: Embrace, extend, and extinguish. That happened almost 20 years ago, but make no mistakes, corporations does not change! Microsoft is the same old company that wants to control everything!

Second, if you look up who is one of the main developers of Typescript, and most likely the one that had been shaped it for years, you will find Anders Hejlsberg. What does he knows about programming? Is an old man that knows nothing about standards. He just had developed programs like Turbo Pascal, and Delphi. And the only thing about languages that he knows, he had done it because is the lead architect of C#. I'm sure anyone in the community would do better.

People only use Typescript because they are used to OO languages

Developers that prefer use Typescript instead of JavaScript, are just frustrated that JavaScript is a functional programming and would rather ignore all the good features of JavaScript and write in the good old object oriented way, and becoming front-end developers wanna be in the way. You have to break the chains bro! You need to understand the freedom that JS give to you and embrace it! And you only can accomplish this if you use JavaScript the old fashion way.

Ok. I will be serious in this section, as this is mostly true. Most of the developers I know that are coming from a OO language, as C# or Java, will try to use TS the way they are used to use those languages. And that is a real problem. TS is not magical sugar on top of JS. You really need to understand JS in order to understand what is TS actually doing for you. If you don't, you will probably end up writing more code than you should, using anti-patterns, and creating more bugs that intended

You can't debug Typescript

Do you use Webpack, Parcel or any build tool that produce source map? Why? You have to stop and just write plain old JavaScript. Because if you compile down you probably will need something else to debug your code. It's better if you write code you can debug only by using the developer tools of IE.

Babel is so much better

I already said that Typescript is not Javascript. But Babel is. Is standard JS that compiles down to standard Javascript. Just compare it: Typescript vs Babel

Typescript is only used in Angular

That's why I don't like Angular either. I've never seen another project using TS. Let me repeat that for you I have never seen another project using Typescript. No one likes Typescript.

Flow is better

Because, why you want another file extension that explicit states you are not writing JS when you can just write types in .js files? Besides, it's support is getting better, with more projects being writing with Flow.

You shouldn't use Typescript

If... You are not confortable. In case you didn't notice it, this is a satiric post, about the people who complains about TS. I'm not saying you should use TS everywhere, I'm sure if you want to do a To-Do app, it would be safe doing with JS. But in my experience, if you are working with more than 3 people TS will help more than it hurts. And I have to say, when you don't know JS, using TS hurts a lot. But I don't think that's on the Typescript team, that's on us.

As developers, we need to learn every language is a tool, that will help us with something. Sometimes you need a hammer, sometimes you need a star key. Not every language fits to everything, and maybe you don't like to use a hammer when you are used to use a star key. But can't just shoot that every one that's using a hammer is wrong, or that they should instead use a star key.

You may as well learn how to use the hammer.

Top comments (107)

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀 • Edited

... where do I start. Let's do classes first. JavaScript class field syntax will in the coming months do exactly what typescript does, no more constructors or super.

Next modules, Microsoft are not phycic, Typescript docs actively discourage the use of namespaces, it is also very hard to deprecate something that legacy systems may rely on.

I could go on but I don't think I will get through (assuming your not trolling), your post may be illinformed.

If you think I'm a regular typescript user, I am not anymore. Mainly because JavaScript will be catching up with the proposals that both Babel and typescript implement. 😘

Edit: based on the comment bellow I should probably read the whole damn post.

Edit edit, thank god this is a joke, I have never met anyone complain about typescript mostly because the only people I know who talk about it have used it, mostly everyone else is at-least curious. I don't think this post will help the junior developer to be honest and could be really damaging. You should try as many languages (supersets) as you can, understand want sucks and the wtf's.

Collapse
 
michaeljota profile image
Michael De Abreu

There are several articles out there pointing right at the core of the post. So, the argument is actually an extrapolation of true thoughts. :P.

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

I was like... Hmm bring it 🥊🔔. I should not drunk comment 🤣, I even made a rage post inspired by my annoyance. Sorry Micheal 😆

Thread Thread
 
michaeljota profile image
Michael De Abreu

This was the post I write inspired by my annoyance. Glad you like it.

Collapse
 
desone profile image
Desone

Read this article and you will know why typescript is taking over:

medium.com/me/stats/post/85c30a370ef5

Collapse
 
orekav profile image
Orekav

Typescript produce .js and .mal
You can use Chrome debugger reading that without any problem.

The factorial function you have posted is a lie, because you could set tsconfig.jsom to allow implicit any.

Angular? Nodejs and React (.tsx) can use typescript too

This post is Garbage

Collapse
 
michaeljota profile image
Michael De Abreu

Why did you stop reading?

Collapse
 
cubiclebuddha profile image
Cubicle Buddha • Edited

If you have to say that it’s satire, then it’s not good satire. The article is more damaging than helpful. If you like TypeScript then I can’t see why you would want to write an article like this that TS-dissenters will likely be reblogging to further their cause. This is due to the fact that most of the people who don’t like TypeScript haven’t actually tried it. And this article just proves their confirmation biases. Instead we should be clarifying why TypeScript makes many of us so happy.

Thread Thread
 
michaeljota profile image
Michael De Abreu

Yes. That's the intention. People should learn to use something before they have an opinion on it. But most of the time they don't. They just read the title an make assumptions.

PS: if you another comments, there are plenty of hints about this being a satire post. You could also open the links for a few more. :P.

Thread Thread
 
avatsaev profile image
Aslan Vatsaev

You're not getting it, if you want to write a good article about TypeScript, then just do so and be straight forward, instead of trying to "teach your readers a lesson about life" (and badly so), nobody wants to play your games and sit there in confusion trying to understand if you're being serious or not while reading your garbage of an article.

Be straight forward, people will appreciate you more...

Collapse
 
orekav profile image
Orekav

The examples are wrong.
Debug: lie
Just Angular: lie
Not compiling .js: LIE!!

Thread Thread
 
michaeljota profile image
Michael De Abreu

Do you always stop reading at the middle of the article?

Thread Thread
 
orekav profile image
Orekav

Yes... But you could do a mocking post putting better things!

Thread Thread
 
michaeljota profile image
Michael De Abreu

Arguments are real through. It wouldn't be funny if the arguments wasn't. For me at least.

Thread Thread
 
steveblue profile image
Stephen Belovarich • Edited

With satire the reader knows what they are getting into. They are supposed to be shown very early on this is a joke.

There is no clear sign post here. You prompt the reader with a very strong word “hate” without then inserting a punch line anywhere.

It’s not funny.

Collapse
 
avatsaev profile image
Aslan Vatsaev • Edited

It's a very bad satire to be honest, poorly executed, and is more damaging than helpful.

Collapse
 
emh333 profile image
Ethan Hampton

It took me way too long to understand the actual intent of the article. Well done😂

Collapse
 
desone profile image
Desone

Read this article and you will know why typescript is taking over:

medium.com/me/stats/post/85c30a370ef5

Collapse
 
jipingwang profile image
Jay • Edited

Disagree all the points.

Modules:

TypeScript is a super set of JavaScript, you use TS syntax in design-time and tsc to JavaScript code for runtime. (Just like most people us JS2015+ in design-time, babel to JS5 for runtime)

Classes

  • the TS class is just like ES6+ class;
  • the JavaScript code is not a ES6+ class, but a ES5 function extending its prototype.

Private properties

today's status: "Public and private field declarations are an experimental feature (stage 3) proposed at TC39".
ES2 (1998) defined the reserved words: class, private, public, etc.
TypeScript uses "private" in class was a natural move.(unfortunately, not same as the es2019). But no break changes for TS developers, you don't hear them cry.

Typescript is not JavaScript

Of course you have errors for the factorial function (if using default tsconfig), that's the most important job TS does -- static type-checking.

The creator of Typescript knows nothing about programming

No comment. ( subjective topic)

People only use Typescript because they are used to OO languages

Not exactly, most of TypeScript (Object Oriented) features are being added to JS.
People use TS mainly because its static type-checking feature.

You can't debug Typescript

Why! I debugged TS in my first TS project.

Babel is so much better

overlapped in code trans-pile, but different others
Babel transforms JS code (high version to low version)
Babel uses TS (plugin) to transforms TS code
Babel uses Flow to transform Flow code

Typescript is only used in Angular

Yes, Angular is only framework forces application users to use TS syntax;
(you can use Angular UMD package in JavaScript, not popular usage)

Flow is better

Subjective. Flow is not standard JS either, it still needs to be transpiled.
Difference Flow vs TS, flow marks inline, but TS marks the extension.

You shouldn't use Typescript

my personal opinion:

  • use JavaScript, if you are application developers.
  • use TypeScript, if you are framework/library/package developers. (when building, deliver cms, ems, umd, whatever to your application users, just like Google material-ui team, VUI, AirBnb, firebase etc.)

my comment about TypeScript

pros: improve JavaScript code robustness, productivity (for experienced)
cons: learning curve high.
remember: TS is for static syntax type checking.

check this really big team experience sharing
youtube.com/watch?v=P-J9Eg7hJwE

Collapse
 
samjakob profile image
Sam (NBTX)

It's satire. (I don't really get it though)

Collapse
 
avatsaev profile image
Aslan Vatsaev

It's satire

a bad one

Collapse
 
michaeljota profile image
Michael De Abreu

I will write property about ts. Hope you like that as well.

Collapse
 
tchaflich profile image
Thomas C. Haflich • Edited

I dunno, I figured out it was a joke right at the beginning:

Typescript is just a big amount of garbage on top of the most wonderful language on ever created, JavaScript, [...]

Not sure I've met any JS developer who would write that down seriously!

I don't actually write any TS though so I have no opinions on the rest of the article's quality of humor ¯\_(ツ)_/¯

Collapse
 
pungiish profile image
Jan

Yeah, that statement gave it out for me 😁

Collapse
 
michaeljota profile image
Michael De Abreu

Yeah... That should give you a hint...

Collapse
 
frostbyte profile image
Brian Bradshaw

Well, if you had used TypeScript, I might have had a hint... 😉

Collapse
 
guitarino profile image
Kirill Shestakov

Sneaky! I was about to get angry, but then I read about the creator and it became too obvious :)

Collapse
 
theodesp profile image
Theofanis Despoudis

That happens when you only read headlines...

Collapse
 
michaeljota profile image
Michael De Abreu

My bad. Bio updated.

Collapse
 
ddonprogramming profile image
Decebal Dobrica

Omg, I am not even sure you are even a programmer, if you were you'd know there are worst things than typescript like go-lang or reasonml or that little language that has errors horrifically done, elm I think it's called.

Collapse
 
michaeljota profile image
Michael De Abreu

I am really sure you didn't read the whole thing. :P.

Collapse
 
ddonprogramming profile image
Decebal Dobrica

Or maybe I read too much and just proved everyone's point

Collapse
 
avatsaev profile image
Comment marked as low quality/non-constructive by the community. View Code of Conduct
Aslan Vatsaev

I did. And the only thing I got from it is that you're bad at writing...

Thread Thread
 
michaeltharrington profile image
Michael Tharrington

Hey there!

Lay off a bit.

It's totally okay that you didn't enjoy the article or the author's approach, but so many comments in one thread to tell them this is a bit excessive.

And no need for personal insults.

Collapse
 
mattmogford profile image
Matt

Is this a joke?

Collapse
 
samjakob profile image
Sam (NBTX)

Yes but I don't get it either lol

Collapse
 
mattmogford profile image
Matt

It went on a bit so I didn't read it all.
Used typescript a few years ago. Getting back into it with React Native now.
Love it!

Thread Thread
 
samjakob profile image
Sam (NBTX)

Yeah I skipped to the end because I was fairly sure. I'm using TypeScript for a project now and it's really neat.

Thread Thread
 
jckuhl profile image
Jonathan Kuhl • Edited

Typescript is my favorite. All the fun of JavaScript, the type safety of Java and little to none of the biggest issues those two languages have on their own.

It’s only a PITA to get type definitions for 3rd party js libraries

Thread Thread
 
michaeljota profile image
Michael De Abreu

You have to notice that you will never have the type safety of Java or C#. Those use an entire different method for type safe and they check on run time.

TS will check as far as it can, and would do it only in build time.

I think this is really important.

Collapse
 
stilllife00 profile image
Mirko Guarnier

Smart. Maybe you should update your description where you say you like typescript to follow the same logic :)

Collapse
 
michaeljota profile image
Michael De Abreu

Forgot about it! Thanks! :)

Collapse
 
mveroukis profile image
Mike • Edited

Anyone who thinks javascript is the most beautiful language ever has mental issues. And Typescript is a stupid bag of garbage and I don't even really consider it a real language. They both suck monkey balls.

Collapse
 
michaeljota profile image
Michael De Abreu

Welcome! :)

Collapse
 
yuriitaran profile image
Yurii Taran

It seems like you were forced to work with JS/TS and it was a real pain. Such a regret! Sorry to hear that. Many thanks for sharing your experience! It's very important that everyone had known that.

Some comments may only be visible to logged-in visitors. Sign in to view all comments.