main.ts

The main.ts file is the application's entry point. It creates an instance of Katana and an instance of Ninja and then invokes one of the methods of the Ninja instance:

import { Ninja } from "./ninja"; 
import { Katana } from "./katana"; 
 
const ninja = new Ninja(new Katana()); 
 
ninja.fight(5); 

Get Learning TypeScript 2.x - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.