DEV Community

Cover image for You should probably learn TypeScript
Ben Halpern
Ben Halpern Subscriber

Posted on

You should probably learn TypeScript

Yes, you.

This post is trending right now...

It's certainly always valid to compare and contrast... Especially as a project decision maker. The pros and cons are very relevant, but as an individual developer, these tradeoffs should not affect your decisions on whether to explicitly take the time to learn this technology.

Learn TypeScript in order to be more employable because of the popularity of this approach to JavaScript, but also learn TypeScript because it is going to open you to new paradigms you might otherwise neglect.

As far as bang-for-your-buck goes, it's probably one of the more valuable learning opportunities out there right now. It's trendy and popular, but it is hardly "hipster technology". You are going to get a lot out of learning this programming language.

... But once you learn it, don't demand that your company immediately adopt it. There are a lot of valid reasons to stay the course. Rewrites are expensive.

Happy coding. ❤️

Latest comments (27)

Collapse
 
pencillr profile image
Richard Lenkovits

I just can't make myself. It's so cumbersome.

Collapse
 
threeal profile image
Alfi Maulana

It's fine for beginner to use dynamic-typed language (JavaScript, Python, etc.). But seriously, you'll find out later about the benefit of static-typed language.

Collapse
 
nasidulislam profile image
Nasidul Islam

I was a skeptic of TS before I tried it. I always wondered why it was necessary - why couldn't we achieve what it is trying to achieve with just better checks and balances in vanilla JS?

Now that I've dabbled in to it - even though I'm still a noob, I see its value. I work at a place that, I would say, has bigger than average turnover ration. By that I mean, devs are frequently walking in and out through the door. For a codebase that doesn't have too many seasoned devs, TS has been the oasis in a desert

Collapse
 
leandroruel profile image
Leandro RR

yeah i'm a new project inside my company and we're using typescript and i'm struggling to learn

Collapse
 
daveappz profile image
David

💯 agree! In the beginning it was frustrating but I literally heard myself say out loud “I love typescript” while pairing the other day. Error driven development FTW.

Collapse
 
jenc profile image
Jen Chan

Went typescript and didn't look back. But it has certainly made me doubt how well I know vanilla js

Collapse
 
heyrohit profile image
Rohit Gupta

Title should be : You should probably learn TypeScript

Collapse
 
thexdev profile image
M. Akbar Nugroho • Edited

The main reason I used TypeScript for my current projects is because TypeScript supports static typing.

No doubt, I have written JavaScript for 2+ years and the main problem I faced is "what data type of this variable/constant/etc".

Yeah, you can comment your code, but write a lot of comment for knowing a data type of a variable is not effective.

Collapse
 
joelbonetr profile image
JoelBonetR 🥇

You need to add context to this post.
I mean, if you are a senior Java or C# (to say something) why should you want to move to TS? If you want to became an AI dev better learn python. Also nothing to do for data career path.

When in learning phase it could be great if you are going for full JS stack, in which case knowing TS is an addition as you'll find it in some companies mixed with JS or using TS as main implementation but otherwise you may probably better focus on your stack.

Either way learning TS is not an excuse for not deeply learn JS and I would suggest to first learn JS in deep and then learn about TS.


From the TS Doc

Learning JavaScript and TypeScript

We frequently see the question “Should I learn JavaScript or TypeScript?“.

The answer is that you can’t learn TypeScript without learning JavaScript! TypeScript shares syntax and runtime behavior with JavaScript, so anything you learn about JavaScript is helping you learn TypeScript at the same time.

There are many, many resources available for programmers to learn JavaScript; you should not ignore these resources if you’re writing TypeScript. For example, there are about 20 times more StackOverflow questions tagged javascript than typescript, but all of the javascript questions also apply to TypeScript.

If you find yourself searching for something like “how to sort a list in TypeScript”, remember: TypeScript is JavaScript’s runtime with a compile-time type checker. The way you sort a list in TypeScript is the same way you do so in JavaScript. If you find a resource that uses TypeScript directly, that’s great too, but don’t limit yourself to thinking you need TypeScript-specific answers for everyday questions about how to accomplish runtime tasks.

Collapse
 
jwp profile image
JWP • Edited

TypeScript taught me to like Javascript after avoiding Javascript for 10 years. I was always a strong typer and into OOP. Now I'm just a polyglot.