Learn
← Previous

Hari 30: Recap & TypeScript Ecosystem

60 min Last updated 09 Apr 2026

30 Hari TypeScript — Apa yang Sudah Dipelajari

Fondasi Type System

  • Primitive types, Type inference, Array, Tuple
  • Union, Intersection, Literal types
  • Interface vs Type alias
  • Enum dan Readonly

Advanced Types

  • Generics dengan constraints (extends, keyof)
  • Utility types: Partial, Required, Pick, Omit, Record
  • Conditional types, Mapped types, Template literal types
  • infer untuk ekstraksi tipe

OOP & Patterns

  • Class dengan access modifiers, abstract, readonly
  • Decorator pattern, Builder pattern
  • Repository pattern dengan generics
  • State machine dengan discriminated unions

Ecosystem

  • Zod — runtime validation
  • tRPC — end-to-end type safety
  • Prisma — type-safe ORM
  • React + TypeScript — type-safe UI
  • Vitest/Jest — testing

💡 Notice: Dependency Injection Container adalah pondasi framework modern (NestJS, Angular, inversify). Generic resolve<T> memastikan type safety saat mengambil dependency.

Assignment

Final challenge: Buat mini dependency injection container yang type-safe. Container menyimpan factory functions dan bisa resolve dependencies.

Expected output:

Selamat datang!
App v1.0.0 siap!
Greeting: Selamat datang!
TS index.ts
Solution
Output