DEV Community

Cover image for TypeScript for Beginners: What You Should Know

TypeScript for Beginners: What You Should Know

Heather Parker on March 19, 2023

TypeScript is a great programming language that was introduced to the public in 2012. This language is a typed superset of JavaScript that compiles...
Collapse
 
idleman profile image
idleman • Edited

Worth to mention is that TypeScript create at least as many bugs as JavaScript so the benefits is rather small compared to JavaScript. Not a popular thing to say, but damn well true:
researchgate.net/publication/35938...

Collapse
 
swordheath profile image
Heather Parker

I completely support this point of view, however I believe that it is quite personal, because for some developers TypeScript has enough advantages compared to JavaScript, while others prefer to use JavaScript only. As I mentioned in this post this is a huge topic for discussion, I thing this is worth writing the whole new post 😁

P.S. Loved the resource you've attached!

Collapse
 
uponthesky profile image
UponTheSky • Edited

Great Article! Here are a few points I want to mention:

  • Personally I prefer doing configuration after running this init command tsc --init and all the tweaks within tsconfig.json. This is because not only is it convenient, but also can you manage your configuration in a single place tsconfig.json.

  • TypeScript could be a huddle for those who are not accustomed to statically typed language. But as your project grows, it's way faster to develop in TS rather than JS since you'll immediately see what each function's interface is once you see the code itself. Currently I use Python for my work, but sometimes it is so painful since some old and big projects in Python doesn't have any type systems(like AWS's boto3 or SQLAlchemy v1.4... so horrible).

Collapse
 
swordheath profile image
Heather Parker

thanks for adding that info!

Collapse
 
ant_f_dev profile image
Anthony Fung

I find the first noticeable benefit of Typescript is having auto-complete when writing code in VS Code. It's true that you get suggestions while using JS too, but it's more refined with TS.

The next major benefit is noticeable when refactoring a large project. Any typos fail immediately instead of silently at runtime.

It's true that there are refactoring tools to do global variable name replaces. However, that relies on a developer using the tools. If someone doesn't use them for whatever reason (e.g. new to programming/unfamiliar with the language and tools) and introduces a bug, it may go unnoticed.

However, the build will break during deployment with Typescript, meaning that it adds an additional safety net.

Collapse
 
swordheath profile image
Heather Parker

Thanks for pointing this out!

Collapse
 
jakeroid profile image
Ivan Karabadzhak

This an excellent introduction for newbies!

Collapse
 
swordheath profile image
Heather Parker

Thanks, Ivan!

Collapse
 
clericcoder profile image
Abdulsalaam Noibi

Thanks for sharing.I will surely start learning TypeScript

Collapse
 
swordheath profile image
Heather Parker

Glad to hear that!

Collapse
 
timlmit profile image
TIM

Cool!

Collapse
 
jareechang profile image
Jerry • Edited

Great article, Heather!

This is me trying to setup typescript every time:

Image description

Collapse
 
swordheath profile image
Heather Parker

That's was me exactly in the begging of my journey 😁

Collapse
 
bredpit31203601 profile image
Lee | AptosLaunch IDO 22nd Nov 22

good