Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
June 26, 2021 05:58 pm GMT

10 reasons why you should use Typescript

Why should you use Typescript?

Simple. It solves your problem. Let's see.

  • Type checking: This is why typescript really exist. It adds type checking over javascript. It stops you to write stupid code.

Alt Text

Let's see an example:

const addNums = (a, b) => {    return a + b}

a and b should be number. But you stupidly pass strings.

addNums('1', '2')

outupt:

'12'

We don't want this to happen. It was a stupid example. But if you are working on bigger project, this kind of bug can happen easily. You waste hours and hours to fix the code.

Alt Text

This where typescript rescues us with type checking.

const addNums = (a: number, b: number) => {    return a + b}

Now if you pass string it will give you error so that you can fix it.

  • Gives error at compile time instead of runtime: Instead of your code giving the error at code run time, typescript will throw you compile error.
  • Object oriented programming: Typescript allow you to use object oriented programming concepts very easily. Like class, interface, inheritance and so on.
  • Predictable Code: If you have type checking, then you know where to put what type of data. And which code will return which type of output. Basically you can predict the code and it is very important
  • Great Intellisense: You will have far more better intellisense with Typescript than JavaScript. If you don't believe me, try it out.
  • Write Next generation code: Typescript allow you to write next generation code. It will compile down your code to older version so that you code stays compatible with older browser and javascript runtime.
  • Absolute import and alias: You can use absolute import and import aliases with typescript. They are super helpful.In case if you don't understand absolute import.

Alt Text

  • Easy to understand: Typescript makes your code a lot easier to read and understand. Because you know what variable is which type and where to use what.
  • Support with most libraries: Most of the third party libraries has typescript.
  • Great community: Typescript has a huge community. It is so much popular that most of the developer uses typescript over JavaScript.

and the list goes on and on........

There is a lot more things that are available on typescript. But I believe they are enough to convince you to use typescript.

So,

Will you use Typescript after reading this blog?

Also if you use typescript what feature do you like most about it?

Please let me know in the comments section. I would love to hear from you.

Shameless Plug

I am creating a video series on my youtube channel about how to build a static blogging site using JAMstack.


What are you going to learn from this video series?

  • ReactJS, NextJs
  • Static Site Generation
  • Dynamic Routing
  • Material-ui
  • MongoDB
  • how to build a real time view counter
  • a small search engine with mongodb and so on.

Project Demo

You can demo the project from here
Alt Text

View the Project code.

So like, share and subscribe to Cules Coding. It takes a lot of effort to build those videos.

If you have any question, put them on the comment section. And also you can connect to me on any social media as @thatanjan. I post content there. So stay safe and good bye.

About me:

Who am I?

My name is Anjan. I am a full stack web developer from Dhaka, Bangladesh.

What problems do I solve?

I can create complex full stack web applications like social media application, blogging, e-commerce website and many more.

Why do I do what I do?

I love to solve problems and develop new ideas. I also enjoy sharing my knowledge to other people who are wiling to learn. That's why I write blog posts and run a youtube channel called Cules Coding

Think we should work together?

Feel free to contact me

Email: [email protected]

linkedin: @thatanjan

portofolio: anjan

Github: @thatanjan

Instagram (personal): @thatanjan

Instagram (youtube channel): @thatanjan

twitter: @thatanjan

About My channel:

Why would you subscribe to Cules Coding?

Cules Coding will teach you full stack development. I will teach you not only the basic concepts but also the advanced concepts that other youtube channels don't cover. I will also teach you Data Structures and Algorithms with abstraction and without Math. You will also find many tutorials about developer tools and technologies. I also explain advanced concepts and technologies with simplicity.

So what are you waiting for?

Subscribe to Cules Coding
so that my friend you don't miss any of these cool stuffs.


Original Link: https://dev.to/thatanjan/9-reasons-why-you-should-use-typescript-4e5h

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To