Install Node.js, then TypeScript: npm install -D typescript
Create a config file: npx tsc --init
Write app.ts and compile it: npx tsc → produces app.js.
Run the result: node app.js
Frameworks like Vite and Next.js compile TypeScript for you automatically.
💡 Key Takeaways: TypeScript Get Started
Mastering TypeScript Get Started helps you write clean and reliable TypeScript code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.
TypeScript Get Started Code Example
TypeScript
function greet(name: string): string {
return `Welcome, ${name}!`;
}
console.log(greet("Sara"));
Output
Welcome, Sara!
Free sign-in required · Google login available
TypeScript Get Started Practice Exercises
Check what you learned in “TypeScript Get Started”.
/ 3 solved
Fill in the blank
Compile the project with the TypeScript compiler.
npx
✓ Correct!Not quite. Try again.
Multiple choice
Which file configures the TypeScript compiler?
✓ Correct!Not quite. Try again.
Code challenge
Write a function double(n: number): number that returns n * 2 and log double(21).
Write the code in the live editor. Your answer is checked automatically.