DEV Community

Cover image for TypeScript is the Only Programming Language you Need to Learn. One language to rule them all!

TypeScript is the Only Programming Language you Need to Learn. One language to rule them all!

Remi W. on October 12, 2021

TypeScript has become extremely popular among JavaScript developers and more and more projects use it as the primary programming language. Today, ...
Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️ • Edited

Learning other languages is also a good idea though. Every front-end web-dev should also have a look at languages like C or Rust to get a better understanding of how many things work under the hood.

It's also a very different way to go about coding that requires a somewhat different way of thinking and problem-solving.

Collapse
 
rammina profile image
Rammina

Agreed, besides other languages in which are used along with Typescript, the language itself has some downsides and case scenarios in which it's not the ideal language to use.

dev.to/rammina/downsides-of-typesc...

Collapse
 
ixartz profile image
Remi W.

Definitively, TypeScript has some downsides. But, once you take the time, TypeScript has a lot of advantages.

You have all the advantages from JavaScript with less negative ones.

Thread Thread
 
rammina profile image
Rammina

Typescript does not have all the advantages from JavaScript.

  • TypeScript can somehow hinder the creativity that JavaScript gives you, because of its clunky boilerplate.
  • Some third-party libraries work well with JavaScript, but are an awful experience with Typescript (those that don't have type definitions files).
  • It also leads to longer build/compile time

Note: I am not personally attacking you, I mean well in the sense that I don't like misinformation.

Thread Thread
 
ixartz profile image
Remi W. • Edited
  • In my previous comment, I was referring for someone has taken the time to learn TypeScript. After the learning time, TypeScript don't influence your creativity. At the end, JS and TS are the same language.
  • All modern framework and libraries have definitions files. Only less popular/unmaintained libraries and framework don't have definitions files. If a project don't have definitions files, it's really a good indication to not use it. Is it a good point?
  • With modern tooling, it's negligible and it doesn't impact your work. Under the hood, it might increase the build/compile time but unnoticeable for a human (the developer).
Thread Thread
 
rammina profile image
Rammina

Unfortunately, I can't agree with you in good faith. Here are my counterpoints:

This is coming from someone who loves Typescript by the way.

Thread Thread
 
ixartz profile image
Remi W.

You haven't understood my responses... I have always put nuances in my responses and you have miss the important notion in my response.

Maybe my writing wasn't good enough or you miss what I trying to say.

Thread Thread
 
rammina profile image
Rammina

No worries! :)

I will stand by my opinion, you can have yours, and so does everyone else.

We can just agree to disagree.

Collapse
 
anuragvohraec profile image
Anurag Vohra

"..has few downside", so does every language!

Collapse
 
Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

Without having properly read the article, I can add my reason for not using TS: I value the flexibility of an untyped language more than the added safety that a type system offers.

Collapse
 
eecolor profile image
EECOLOR

TypeScript has quite a flexible type system. However to express some more complicated types requires quite a lot of effort and knowledge.

Important things that I think are missing:

  • Type inference for arguments based on usage
  • A way to express intent (for example: the function expects a User) combined with actual usage (for example: the function expects something that has a name property). It would be great if any type system would combine this. Note that this is explained better here: youtube.com/watch?v=YR5WdGrpoug
Thread Thread
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

I think you're attributing more features to a type system than it should actually have. When you start adding predicates like "having a name field" you're ending up back at set theory.

Thread Thread
 
eecolor profile image
EECOLOR

Might be. I was thinking more along the lines of Nominal typing vs Structural typing and in a sense a mix between the two.

Collapse
 
fjones profile image
FJones

I still maintain that dogmatic type-safety is a crutch to solve structural problems more than anything. I have never once thought "Well, this wouldn't have happened if this had type declarations". Not in PHP, not in Python, not in JavaScript. I've very much thought "Why did this API suddenly change?" and "Where's the goddamn documentation for this?", though.

That's not to say there aren't any benefits to an opinionated, strongly-typed language (as TypeScript would like to be). When the language is built from the ground up with the ingrained opinion that it must prevent developer error at any cost (Golang is an excellent example of this), it does have some charm. Golang in particular goes a lot further than TypeScript, though, and ironically makes you feel a lot less dirty for using interface{} than TypeScript does for any (or Java does for <? extends Object> :P )

The drive to make every language type-safe obscures the real issues of language design. PHP's often confusing APIs randomly swapping argument order, Python's indifference to type inferrence, JavaScript's habit of thinking everything is a float under the hood... These issues aren't solved by making the languages type-safe. And neither does it really solve developer errors.

If anything, TypeScript in particular (due to compiling down to JS) can give you a false sense of security. Type defs are maintained often independently of the actual code mapping to them, and handling external data still runs the risk of runtime errors due to bad assumptions or changes in APIs (browsers maintaining dozens of different engine levels also wreaks some havoc at times).

Thread Thread
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

Yep I totally agree with this. I use Ruby at work, Lua at home and JavaScript both at work and at home; and the types of errors I deal with are almost always related to much more complicated things than a value having the wrong type.

Having worked with languages like C and Pascal before, I'd even say it's the opposite: not having to type your variables is one less thing to keep in your head making a bit more room for the actual logic you're trying to translate into program code, so it helps with reducing bugs caused by dumb oversights.

Just as a small anecdote to underline this: The last bug I found today was that a function to calculate the length of some text was being called before the applications fonts had been fetched, so it used some default font of the browser instead and the result was off by a few pixels. No amount of typing could have fixed this, and in the end the problem was fixed by reasoning about what's happening. Those sorts of high-level problems are the ones I find myself solving most of the time, whereas type mismatches are usually a matter of reading an error message and saying "Oh, of course, this has to be a number"

Collapse
 
rammina profile image
Rammina

Thank you so much for this article!

It's really informative, well-formatted, and I enjoyed reading it.

Collapse
 
ryannerd profile image
Ryan Jentzsch

Overall TS brings some sanity to an insane language. Mostly helping to catching bugs before running being the primary benefit with the secondary being making it easier to reason about your interfaces, for example with function foo(s: string, n: number): boolean you know the expected arguments are a string and a number with the return type of boolean. All major IDEs leverage TS providing type hints.

There are some disadvantages:

  1. Upfront time. TS will bitch and moan at everything it thinks isn't type safe. Forcing you to include type guards and other reassurances to TS that the variable it's complaining about really is expected to be a number prop.onClick(id as number)
  2. There are some situations where TS is overtly difficult to implement for example 3rd party data that you have no control over the structure and types.
  3. To overcome #2 you can write generics and type overrides but once again this falls into the #1 disadvantage.
  4. TS error messages are sometimes difficult to understand and even a trip to SO can still leave you scratching your head.
  5. If your code is littered with @ts-ignore there's a bigger problem than TS going on.
Collapse
 
rammina profile image
Rammina • Edited

I agree with your points. We have a lot of overlaps when it comes to opinions about its downsides.

Number 4 is so awful and relatable. Even a popular library like redux-form has really bad issues with Typescript, and people over at Github and SO are struggling to find stopgap solutions to errors.

Collapse
 
rammina profile image
Rammina

I get it, you love Typescript, a lot of people love that language, and so do I.

However, your title is clickbait and it can be misleading for beginners. The article is nice and well-written, but I'm going to have to disagree with some points.

In any case, here are some scenarios and downsides of Typescript:
dev.to/rammina/downsides-of-typesc...

Collapse
 
ixartz profile image
Remi W.

Oups, spotted, I'm huge fan of TypeScript... In this article, I was trying to hide my love to TypeScript 🤣

To be fair, in my article, you can replace every reference to TypeScript by JavaScript. It also works.

My point are that both languages are very versatile.

Collapse
 
rammina profile image
Rammina

Sure, you really love Typescript. I know you mean well.

However, it does not change the fact that some of your points are misleading, and the fact remains that Typescript is definitely not the only language you need to learn.

I'm just saying this for the sake of beginners who walk into this thread/post.
I don't want them to start thinking that all they need to learn is Typescript, because that is not true at all.

A more appropriate title and introduction would be, "Typescript is a versatile language and I love it."

Collapse
 
talr98 profile image
Tal Rofe

Sticking to one language is simply not possible that's all.
Each language has its own dedication. There are things you won't implement using javascript but rather Golang or Python ..

Collapse
 
ixartz profile image
Remi W.

Some developers will argue HTML and CSS aren't a programming language 🤣 I think it definitively make sense to build webapplication and mobile application in one language for a small team with limited resource and time.

Python has huge advantage in Data Science and the community in this field seems much more larger. Golang are more targeted to low level but for high level application like web or mobile, TypeScript can be one of the solution 😃

Collapse
 
evilprince2009 profile image
Ibne Nahian

Lol!
Don't get me wrong , I'm not a TS hater.
But one language for everything is such a bullshit , idiotic ideology & this works only for those fanboys who are averse to learn others stuff. Never fall in love with one solution for every problem , this is like using hammer for breaking an egg. Every project has different requirements and every problem requires different solution.

Collapse
 
ixartz profile image
Remi W. • Edited

Same here, don't get me wrong, I'm not a multi-programming language hater.
I started programming in PHP on LAMP stack. Doing Java & React stack for full-stack application. Making some game in C#, doing machine learning and image processing in C++, reimplementing bash shell in C from scratch, etc...
And yes, every project has different requirements and context.

I didn't give enough of my context in my article. I'm indie maker with limited time and resource. I'm currently building high-level application as a solo developer. So, one language is appealing.

Collapse
 
damienpirsy profile image
Matteo Vignoli

Sticking to a single language for everything is the second worst thing you could do (the first is using TypeScript as only language). Nowadays it's always "use JS for everythiiiiiiing!", so I get why you would say "use TS for everythiiiiiiiing", but actually you're making a silly mistake that's hurting your developer career - but you're most likely young and think that at 30 you're old and decrepit, so it's no point arguing with you. Your approach to programming is toxic, short sighted and naive, but you got the likes and the clicks I guess it's enough for you.
Keep spreading your message, more opportunities for us older folks who can use several languages according to the needs. Cheers!

Collapse
 
ixartz profile image
Remi W.

Sorry, you've made some wrong assumption... I'm an older programmer (if you consider someone above 30).
I'm a multi language programmer: I started programming in PHP on LAMP stack. Doing Java & React stack for full-stack application. Making some game in C#, doing machine learning and image processing in C++, reimplementing bash shell in C from scratch, etc... the list goes on.
I won't argue more, whether my title has been misleading whether you didn't read the article. Cheers!

Collapse
 
damienpirsy profile image
Matteo Vignoli • Edited

That's even more surprising, so either you've hopped on the fanboy train or you've forsaken all your experience and knowledge in favor of, what? Lazyness? Having used the "right" tools for a job - for several jobs, actually - do you really believe typescript to be a valid susbstitute, or you've just making a proof-of-concept? Would you really trade C# (or even an interpreted lua) in favour of TS for game development, for example?
Your article says you "might", your title says you "ought to", you're experience says "you shouldn't and you don't".

Collapse
 
badpractice profile image
Bad Practice

I'm gonna be real. I personally refuse to build a social network with a scripting language. I also gave up on PHP. I've moved on to converting all of my backend to Rust for the most part. It's amazing in the frontend, but that's my limit.

Collapse
 
jayjeckel profile image
Jay Jeckel

Typescript is awesome for bringing some sanity to the chaos that is javascript, but even if there was a single language suitable for everything (which there isn't), it wouldn't be typescript or any javascript-based language. And I can't be alone in preferring to set my servers on fire before I'd ever use any kind of javascript outside the front end of a web stack; it just isn't a language that holds up in the worlds of strongly typed precompiled languages.

Collapse
 
valeriavg profile image
Valeria

Oh, sweet summer child!
Once you open the Pandora's box of Dev tools there's no going back.
At the very least you'll learn a bit of bash, at least one database query language and whatever your favourite framework comes up with.
And when you think the worst is over, you'll end up neck-deep in DevOps and native nodejs plugins in some CPP or Rust.
After that, it'll snowball to WASM, or WebGL shader programming. Till the moment you'll find yourself spending your Saturday on Go tutorials.
The worst of it all: you'll enjoy it!

Collapse
 
anuragvohraec profile image
Anurag Vohra

"Sticking to a single language is not ideal if you want to grow as a developer", yes, but additionaly to what you say, picking a langauge which can do many things is good skill set to have (along with others)! (Specially when you want to venture as a startup: The maximum potential of a developer).
As one can't be good in everything, but can be excellent in one thing!

Collapse
 
lioness100 profile image
Lioness100

Typescript supremacy 💪😎

Collapse
 
ixartz profile image
Remi W.

TypeScript is the best language 🎉😛

Collapse
 
yoshida profile image
Masao Yoshida

A person who knows only one language cannot know the superiority of that language over another.
Every language has its own advantages.
Other languages have already perished from the world.