🛠️ Installation of TypeScript
📥 Step 1: Download TypeScript
To download the latest version of TypeScript, visit the official website:
👉 https://www.typescriptlang.org/
Alternatively, if you have Node.js installed, you can install TypeScript globally using npm:
npm install -g typescript
✍️ Step 2: Write Your First TypeScript Program
Create a new file named
first.ts and add the following code:
var message: string = "Rajesh Kumar";
console.log(message);
🖥️ Step 3: Compile and Run the TypeScript Program
➡️ Open Visual Studio Code Terminal and compile the TypeScript file:
tsc first.ts
This will generate a first.js file in the same directory.
➡️ Run the compiled JavaScript file using Node.js:
node first.js
✅ You will see the output:
Rajesh Kumar