broken.ts

The companion source code also includes a file named broken.ts. This file contains some compilation errors on purpose because it is used to demonstrate how to perform error diagnostics:

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.