Classes — TypeScript · Foundations

A service that receives its store through its constructor and hides what it keeps, the shape of every provider in NestJS: parameter properties, private and readonly, static members, getters, and a class that implements an interface.

What you will learn

Read the theory for Classes

All TypeScript lessons

All Foundations courses

loading types…

What you'll learn

  • Declare fields, a constructor and methods, and use parameter properties to receive and keep a dependency
  • Hide state with private and protect it with readonly, and share a constant with static
  • Implement an interface, and depend on the interface so any object with its shape can be passed in