Strong tools for large apps
Personally, I love TypeScript. And in the case of Office.js, I think it is quite indispensable for writing non-trivial code. Take a look at a screenshot of some simple code snippets in Visual Studio, with all four of the pain-points I mentioned earlier. With TypeScript, each of the first three statements are highlighted as errors, and by specifying my parameter types (e.g., “
table: Excel.Table”), I can keep the full power of IntelliSense even when passing objects across function boundaries.
For purposes of code samples in this book, I will mostly refrain from using TypeScript annotations (type names, modules, classes, and various syntax-sugar), simply so that everyone can easily get my code samples running, regardless of whether or not they’ve jumped on to the TypeScript bandwagon. That being said: especially with the async/await features of TypeScript 2.1, along with other ES6 goodness like template strings, developing with TypeScript is delightful. Once you’ve tried it, I don’t think you’ll ever look back!