Not All Code Paths Return a Value in TypeScript

I’ve been working on a TypeScript implementation of the Oware variant of Mancala, and ran across an interesting case which is currently NOT a compiler error in TypeScript v1.7: public MakeMove(board: Board): boolean { var pos = this.clickedPosition; this.clickedPosition = null; if (null === pos) { return false; } if (this.id === pos.player) { if (board.GetStones(pos) […]

Default Arguments and Variable Arguments in Typescript

For my money, the Typescript language is a great way to extend JavaScript, while still transpiling into functional (and readable) JavaScript. Case in point – default and variable arguments.  Default arguments assign a default value to a function’s parameters so you do not need to specify every parameter when calling.  In JavaScript, a quick conditional […]