Interfaces and Classes

Developed with

The course is part of this learning path

Typescript: Zero to Hero
Start course


This module introduces you to Interfaces in TypeScript.

Learning Objectives

The objectives of this module are to provide you with an understanding of:

  • How to use Function Types
  • How to use Optionals
  • How to use Excess Property Checks
  • How to use Indexable Types
  • How Interfaces work with Classes
  • How to create Extendable Interfaces

Intended Audience

This learning path is aimed at all who wish to learn how to use TypeScript


It is essential you understand the face of contemporary web development to attend this course. You should have a good working knowledge of Javascript. Please note: Before attending this class delegates must have a Microsoft account (signing up one is free).


We welcome all feedback and suggestions - please contact us at to let us know what you think.


Ensuring our class meets a particular contract is one of the most common uses of interfaces in C# and Java. It's also possible in TypeScript. We can define both properties and methods in the interface, and a class that signs the contract must implement them. The code shown applies the Vehicle interface to the car class. This is done using the implements keyword and the name of the interface. And if we wanted to use several interfaces, we would separate their names with a comma. A class implements the interface by providing a way to set its fluxCapacitor property if it's present. And an implementation for the required accelerate method. It also has a method to determine if time travel is possible. We instantiate the class, and then use the accelerate method to increase the speed. The new speed will be logged out as 500. We also call the timeTravel function, passing in the instance's value of fluxCapacitor as the argument. This would output Time travel not possible, as the car was not instantiated with a flux capacitor.


About the Author
Learning paths6

An outstanding trainer in software development with more than 15 years experience as a Corporate and Apprentice Trainer, ICT Teacher and Head of Department, with a passion for technology and its uses. Continuing to develop existing and new skills and courses, primarily in web design using PHP, JavaScript, HTML, CSS and SQL but also OOP (Java), programming foundations (Using Python), DevOps (Git, CI/CD, etc) and Agile/Scrum. Practically minded, a quick learner and a problem solver with an attention to detail to ensure high quality outcomes.

Covered Topics