Skip to content

Interface

  • An object that contains all the type annotations for its properties
interface Vehicle {
  name: string;
  year?: number; // Optional property!
  broken: boolean;
  summary(): string; // A function that returns a string
}
  • A typical TS file consists of Interface definitions for working with the class and the class definition