TypeScript Interfaces and Classes

Learn about interfaces in TypeScript and their use in defining data types for variables.

Overview of interfaces

Interfaces in TypeScript are like models. They describe what a class or object’s methods and properties should be.

Let’s demonstrate the idea of interfaces with an example. First, we’ll create a simple Player class that has a name property and a shootBall method that returns a string.

Get hands-on with 1200+ tech skills courses.