loading...

Why Do We Need to Use Typescript?

kojikanao profile image Koji (he/him) ・2 min read

Why Do We Need to Use Typescript?

This was what I thought when I started using Typescript.

I knew Typescript a couple of years ago. At that time, I thought it would sound good. However, I didn't need to use it since at that time I didn't use React.js and project I worked wasn't really using js.

Then, I met my friend who loves Typescript during I was working for my startup.

He always told me Use Typescript because it's legit!!!!

I was like "Okay man, I will try it soon." I didn't think about it seriously. Actually, I tried a couple of tutorials (very simple and small). Unfortunately, I didn't see its necessity.

Later 1 year, I started working on React.js + Typescript.
My co-workers told me about the necessity of Typescript. In theory, I could understand that, but to be honest it didn't hit me since I had a kind of tough time with Typescript.

However, now it really hit me.

I agree with this and what my friend told.
https://dzone.com/articles/what-is-typescript-and-why-use-it

The thing that really hit me is readability.
When I read Nodejs project code a couple of weeks ago, I got really confused since I wasn't familiar with the variable naming rule of the project, so really tough to predict the type of variables.

But, I don't think everyone should use Typescript
I guess to start using Typescript there should be a couple of things

  1. Members are familiar with ES6
  2. A transition period is predictable
  3. There is a person familiar with webpack

Simple template reactjs+typescript
https://github.com/koji/webdev

The thing is that I haven't finished my portfolio site with react+typescript lol

Discussion

pic
Editor guide
Collapse
stemmlerjs profile image
Khalil Stemmler

Using React.js with a team w/o types is pretty challenging to prevent writing bugs.
I also recently finished working on a React + TypeScript project and I think I'd always suggest TypeScript in a team setting if possible.

This is a discussion I also kept finding myself in, so I laid out exactly when it makes most sense to use TypeScript, and when using Vanilla JS could probably suffice.

tldr; it depends on team size, if the domain is complex, if it's a personal project, if you're using a framework, etc

khalilstemmler.com/articles/when-t...

Collapse
kojikanao profile image
Koji (he/him) Author

Totally makes sense!

Collapse
shadow1349 profile image
shadow1349

I think one of the things Typescript does really well is give people who usually use strongly typed languages (like C# or Java) a great way to transition to Node. It's also a great way to build for any nodejs environment (i.e. es5, es5, web, etc).

Also, I feel as though I should say that if you really want to unleash Typescript on a front end project go with Angular, it's built to use Typescript natively and their CLI is far more rich in features. You'll spend a lot less time on boiler plate code.