Yesterday one of the readers of my ASP.NET Core and Angular 2 book opened the first GitHub issue of the official book source code repository. The problem he was experiencing was related to an odd TypeScript error that seemingly prevented him to compile the sample code shown in Chapter 1.
The error was the following one:
error TS5023:Build:Unknown compiler option ‘listemittedfiles’.
Apparently, the problem was related to a strange option switch used by the Visual Studio 2015’s MSBuild task:--listEmittedFiles
, which has been introduced in TypeScript 2.0 and shouldn’t be used with earlier versions of TypeScript such as the one he was using to compile my project, which was 1.7.5.
While I was trying to help the OP to figure out his issue, I was soon backed up by another book reader, Wmlockhart, which suggested an easy and effective fix: download and install the updated Visual Studio TypeScript Tools, which is shipped with the latest (at the time of writing) TypeScript 2.0.6 and will configure MSBuild to use that build instead of the previously installed 1.x ones.
The latest TypeScript version has no problems with the book’s source code and also fully supports the--listEmittedFiles
switch: a big thank to Wmlockhart for suggesting that!
On a side note, I would really like to figure out what caused VS2015 to use a non-existing command-line switch with a lower version of TypeScript. I guess the users experiencing such issue could have installed/removed TypeScript 2.0 and/or have a corrupted Visual Studio installation due to the tons of patches, updates and preview tools that made their way out within the past few months. For those who want to know more about this, I strongly suggest to take a look of this post which shares some light about that.