tests/cases/compiler/matchReturnTypeInAllBranches.ts(30,20): error TS2322: Type 'number' is not assignable to type 'boolean'. ==== tests/cases/compiler/matchReturnTypeInAllBranches.ts (1 errors) ==== // Represents a monster who enjoys ice cream class IceCreamMonster { private iceCreamFlavor: string; private iceCreamRemaining: number; private wantsSprinkles: boolean; private soundsWhenEating: string; public name: string; constructor(iceCreamFlavor: string, wantsSprinkles: boolean, soundsWhenEating: string, name: string) { this.iceCreamFlavor = iceCreamFlavor; this.iceCreamRemaining = 100; this.wantsSprinkles = wantsSprinkles; this.soundsWhenEating = soundsWhenEating; this.name = name; } /** * Tells the IceCreamMonster to eat their ice cre am! * * @param {number} amount The amount of ice cream to e at. * @return {boolean} True if ice cream remains, false if there is no more ice cream le ft. */ public eatIceCream(amount: number): boolean { this.iceCreamRemaining -= amount; if (this.iceCreamRemaining <= 0) { this.iceCreamRemaining = 0; return false; } else { return 12345; ~~~~~ !!! error TS2322: Type 'number' is not assignable to type 'boolean'. } } } var cookieMonster: IceCreamMonster; cookieMonster = new IceCreamMonster("Chocolate Chip", false, "COOOOOKIE", "Cookie Monster");