This content originally appeared on DEV Community and was authored by Anjan Shomodder
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.
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.
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.
- 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
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: anjancules@gmail.com
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.
This content originally appeared on DEV Community and was authored by Anjan Shomodder
Anjan Shomodder | Sciencx (2021-06-26T17:58:07+00:00) 10 reasons why you should use Typescript. Retrieved from https://www.scien.cx/2021/06/26/10-reasons-why-you-should-use-typescript/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.