DEV Community

Discussion on: Pitch me on TypeScript

Collapse
 
mxrcochxvez profile image
Marco Chavez • Edited

I can’t believe this doesn’t have more discussion yet! My favorite part about using Typescript is that it’s self documenting! When you specify the props and the return type when defining the function and you’re using an editor like visual studio code - wherever you call the function you can hover over the name with your mouse and it tells you exactly everything about that function.

An added benefit for us React devs is that it helps you with remembering to send all required props to a component in React since you’re able to pre-define prop types.

It’s balanced. Depending on the project you’re making, you can configure Typescript to catch more or less code quality inconsistencies in the config file!

Collapse
 
haydenmcp profile image
Hayden McParlane

I've never actually written any serious TypeScript though I've been working with JavaScript for a while. Even for me, though, the self-documenting nature of TypeScript is really helpful. For example, when I'm looking at an npm package to see how to use it TypeScript makes it easy to understand. I read it all the time.

Collapse
 
mxrcochxvez profile image
Marco Chavez

Yeah exactly! Even when you aren’t using TypeScript it’s beneficial that people have written npm packages with TypeScript. Thanks for your contribution to the discussion. That’s another great point.

Collapse
 
diballesteros profile image
Diego (Relatable Code)

The self-documentation is definitely one of my favorite parts. Used correctly it helps me come back to my code months later and understand what the heck I was trying to do.

Collapse
 
gavravs profile image
Gourav Dhongadi

Can you suggest some good resource to learn typescript

Collapse
 
mxrcochxvez profile image
Marco Chavez

youtu.be/BwuLxPH8IDs

This is a YouTube video I followed! But I mostly just used the documentation and experimented in the projects I was working on.

Collapse
 
harrywonder profile image
stephen

Hello Gourav, I’m currently working on a typescript project for beginners. Hope you don’t mind if I share the repo with you once I’m done?