2024: A Landmark Year for Global Crypto Regulation
A to Z Full Forms and Acronyms

What is TypeScript?

Apr 29, 2020 TypeScript, TS, 3523 Views
In this Article you'll See some of the key points about TypeScript.

What is TypeScript? 🧐 ⁣ ⁣ ⁣
⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⁣
is the typed version of JavaScript, built by Microsoft, compiles down to JavaScript, and tends to be less error-prone. ⁣ ⁣
⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⁣ ⁣
🤯What are the advantages of TypeScript? ⁣ ⁣
⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⁣ ⁣
The fact that it catches the errors in your code which leads to understanding your code better and makes it less error-prone, easily sets TS as one of my favorites. ⁣ ⁣
⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⁣ ⁣
👉🏼If you see JavaScript like this: ⁣ ⁣
⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⁣ ⁣
export const Count = (value) =>{...}; ⁣ ⁣ ⁣ ⁣
⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⁣
You can write it on TypeScript like this:👇🏼👇🏼👇🏼 ⁣ ⁣ ⁣
export const Count = (value: number) =>{...}; ⁣ ⁣
⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⁣ ⁣
As you can see we just defined the type of our parameter, we're saying the "value" parameter should be a number and if it's not a number... our code will get an error... Woah!! I mean, that's amazing, it's like having a friend give you a hint that you may not understand your code but TS does! ⁣ ⁣ ⁣ ⁣
⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⁣
How to declare the syntax? 🤓 ⁣ ⁣
⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⁣ ⁣
Write the name of the variable followed by: and the type like this and then followed by = and the value of the variable: ⁣ ⁣ ⁣
⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⁣ ⁣
let myVar: string = "hi"; ⁣ ⁣ ⁣

💬 Have you ever used TypeScript? Shared your thoughts below 👇🏼👇🏼 ⁣

A to Z Full Forms and Acronyms
Gigi Codes

Gigi Codes

Gigi | React Developer🔺 Mentor 🇻🇪 Venezolana📍San Francisco, Ca 👩🏼‍💻 Frontend Engineer @forethought.ai

Cookies.

By using this website, you automatically accept that we use cookies. What for?

Understood