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
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Type Aliases & Interfaces | TypeScript Mastery lesson | BraveProgrammer
  1. Courses
  2. /
  3. TypeScript Mastery

Lesson 6 of 56

·Typescript

Type Aliases & Interfaces

20 minutes

Course progress11%

Type Aliases (type)

type Point = { x: number; y: number };
let p: Point = { x: 1, :  };
y
2

Aliasing works for any type, including unions, intersections, and primitive literals.

Interfaces

interface Person {
  name: string;
  age?: number; // optional property
}

const alice: Person = { name: "Alice" };

Extending Interfaces

interface Employee extends Person {
  employeeId: string;
}

const bob: Employee = { name: "Bob", employeeId: "E123" };

Declaration merging

If you declare the same interface twice, they merge:

interface Window { myProp: string; }
interface Window { another: number; }
// Window now has both properties

Info

Use interfaces when you need declaration merging (e.g., augmenting global types). Use type aliases for complex compositions.
Make it stickPractice what you've learned1 quiz · 3 practical tests · Optional activities from TypeScript MasteryBrowse activities
Previous lessonLiteral Types & EnumsContinue to lesson 7Functions – Parameter & Return TypesBack to TypeScript Mastery curriculum