If you develop Typescript applications in projects using TFS as source code control, you need to take precautions to build or publish your web application.
As the .ts and .js files are related in a VS project (.csproj) in the form
<TypeScriptCompile Include="Scripts\Index.ts" /> <Content Include="Scripts\Index.js"> <DependentUpon>Index.ts</DependentUpon> </Content>
when you check-out the .ts file, the .js is automatically checked out. The DependentUpon clause is also responsible for displaying the two files as parent-child nodes in Solution Explorer.
However if you build and the .ts file has not been checked out, the Typescript compiler is unable to generate the .js file, as it is set read-only in the file system.
I know of two solutions to this problem:
The first (and probably simpler one) is to include the .ts file in TFS, but NOT the .js file. This is achieved by adding the .ts (and automatically, the .js) file in TFS, but reverting the Add operation for the .js file.
The other solution is similar to the one I sketched about 3 years ago, namely to run tf checkout
before and tf checkin
after invoking tsc.
By the way, you can ignore the .d.ts (definition) files in this scenario, as they do not generate .js files.