Basics

Challenges

Classes

Cookies

Debugging

Events

External Files

Flow Control

Forms

Functions

Html Elements

Installation

Interfaces

Keywords

Modules

Namespaces

Operators

Reference Files

String

Types

TypeScript - Duck Typing

Tip: Interfaces cannot be directly instantiated. They can however, used to define a Type.

"duck typing" is sometimes used to describe when one object is defined as another type who's shape just happens to match.


interface Employee
{
    Name: string;
    Title: string;
}

let Developer =
{
    Name: "Ricky Bobby",
    Title: "Senior Developer",
    Editor: "Visual Studio Code"
}

let newEmployee: Employee = Developer;