Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. JavaScript Course

Lesson 30 of 55 · javascript

Intro to TypeScript (Optional)

Duration: 12 mins

TypeScript adds static typing on top of JavaScript.

npm install -D typescript
npx tsc --init

tsconfig.json

{
  "target": "es2020",
  "module": "esnext",
  "strict": true,
  "sourceMap": true
}

Simple TS file:

function greet(name: string): string {
  return `Hi, ${name}`;
}
console.log(greet('World'));

Compile with npx tsc.

Benefits

  • Early detection of type errors.
  • Rich IDE autocomplete.
  • Gradual adoption – rename .js to .ts one file at a time.
Previous: Debugging – Chrome DevTools & Source MapsNext: Security – XSS, CSP & Input Sanitisation