How to Typescripting (Part 1)
Beginner guide with no experience in coding to start coding with typescript
Why Typescript ?
The Advantages of Typescript
- Early spotted bugs
Researchers found that TypeScript detects 15 percent of common bugs at the compile stage. Although it’s far from 100 percent, this amount is still significant enough to save developers time and let them focus on correcting mistakes in the logic. It means Typescript is safe typing, so we are able to spot bug before any buggy code get into a production environment.
When we declare a variable as a string or a boolean, everytime we want to reassign the variable, we know that the variable will be always as a string or a boolean no matter what happen in the code.
let name: string = "John" // its always string
let isActive: boolean = true // its always boolean
Due to the strict types and others utilities, the code will be more expressive, which means if this logic runs, it’s more clear what will happen next or what will be the value of a variable after some code run through. You can see the design intent of developers / engineers who originally wrote the code. A code that speaks for itself can offset the lack of direct communication between team members.
The Typescript Trends
Beginner guide for no Experience in Coding
You can check this video: https://biteable.com/watch/3211035/b160704017f4b348e742fc39c1329354
- Download and install https://code.visualstudio.com/ , choose between 64 bit or 32 bit if you are using windows.
- Download and install https://nodejs.org/en/ , I recommend the LTS version, choose between 64 bit or 32 bit if you are using windows.
- Download https://cmder.net/ and extract it on your D:\ *windows users only
- Open your terminal / cmder and type this:
> npm install -g typescript
// wait until its done
> npm install -g ts-node
// wait until its done
5. Open your visual studio code (already installed)
6. Try to code with simple hello world
7. Compile and execute it with
- Make sure Typescript, NodeJS and Npm are already installed on your device.
- Open your terminal and type this
> tsc -v
> Version 4.0.2 //example version> node -v
> v10.16.3 //example version> npm -v
> 6.9.0 //example version"
💡 I would like to recommend you to search more about the detail of typescript, it is important for you to understand the concept first, before you start to code with typescript.