Why learn TypeScript?

I have posted the article here, incase you didn't read on @hashnode

Read on codingthunder.hashnode.dev/why-should-you… for better experience

#TypeScript #javascript #Microsoft #Thread 🧵
Some facts about TypeScript

- TypeScript was developed by Microsoft about 8 years ago (first public release: 1 October 2012)

- TypeScript is a superset of JavaScript, which means that every valid JavaScript code is a valid TypeScript code
- TypeScript is written in TypeScript. That's called recursion

- Morever, TypeScript source code is available on GitHub with 8.7k+ forks and 65.2k+ stars ⭐

- TypeScript is compiled to JavaScript

- C# and TypeScript were developed by the same developer, Anders Hejlsberg
Why should you learn TypeScript?🤔

1. TypeScript provides you with types in JavaScript.

What does that mean?

JavaScript not provide you to define the type of variable you want while declaring it. The type keeps changing according to the value assigned to it.
But using TypeScript you have this feature

TS :
var hello:String = "Hello World";

JS:
var hello = "Hello World";
TypeScript Compiler compiles your *.ts file and checks for any errors in types. If you try to assign another type of value to a variable, then your TypeScript Compiler will surely give you an error.

Means if you write this code

var hello:String = "Hello World";
hello = 123;
Then you will get this error Type 'number' is not assignable to 'String'

Looks like a nice catch, isn't it

Im different words TypeScript is strongly typed language
2. TypeScript is Open Source

What makes a developer feel more proud then using an Open Source software? Nothing, Yeah😇!
3. Huge community

TypeScript has a huge community of developers on Stackoverflow and other sites. So, if you will ever fall in some problem, there will be always someone to help you out.
4. Better for huge projects

TypeScript is mainly used for large projects becuase it provides much better exception catches.

Some awesome examples of Open Sourced TypeScript projects:

- Visual Studio Code
- Angular
- Tensorflow
- GitHub Desktop
- Vue
5. Much more like other popular languages like C#, C++, or Java

Many people feel that TypeScript is much related to C# because TypeScript's syntax is much more similar.
A default support for enum
Yeah! You heard that right. TypeScript has a default support for enum classes which is very much similiar to that of C++.

An example of enums in TypeScript

enum S {
NO = 0,
YES = 1
}
Unions in TypeScript
If you have learnt C or C++, then you may be probably familiar with union types.

Unions in TypeScript are somewhat different from them. In TypeScript union is a variable with multiple types.

Example of union in TypeScript
let myVar : string | number; //Variable with union type declaration

myVar = 100; //OK
myVar = 'Lokesh'; //OK

myVar = true; //Error - boolean not allowed

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with YAKSH BARIYA 👨‍💻

YAKSH BARIYA 👨‍💻 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @CodingThunder

1 Sep
Ever wanted to learn coding but don't know from where to get started...

This thread 🧵 might help you.

#100daysofcode #programming #Coding #CodingTips #Thread #StartLearning #CodeNewbie @CodeNewbies
1. What you are interested in???

Do you want to create a website, or wanna deploy your apps on #Google PlayStore or #Apple @AppStore. Or you are learning just for fun...

Ask yourself this question before starting with actual coding
2. Choose your language according to your needs...

For eg for becoming a Front-end developer you need to know HTML, CSS
For making Android apps you need to learn Java
For making a completely working website you need to know JavaScript, HTML and CSS
Read 8 tweets
18 Aug
My favourite VS Code extensions...

These are best of my favourite ones...

🧵 This is a thread 🧵

#programming #coding #CodeNewbies #CodeNewbie #Developer #java #javascript #python #DevComIN #DEVCommunity #100DaysOfCode #vscode @code #html #100DaysOfCloud #code #android
1. TabNine
• AI coding assistant
• Better auto-completes
• Understands patterns in your code
• Fast
2. Prettier
• Enhance readability of your code
• Make your code look more beautiful
• Fast...
Read 21 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!