How to include TypeScript files when publishing?

I achieved this by editing project (csproj) file. I included .ts (they are stored in TypeScriptCompile item) files into Content item i.e.

  <Target Name="AddTsToContent" AfterTargets="CompileTypeScript" Condition="'$(BuildingProject)' != 'false'">
     <ItemGroup>
        <Content Include="@(TypeScriptCompile)" Condition="'$(Configuration)'=='Debug'"/>
     </ItemGroup>
  </Target>

Note: Because of the condition, this includes the TypeScript content only for the Debug build configuration.


Based on Stas Berkov's answer, I am conditionally including the .ts files only when the source maps are generated (as configured in the TypeScript Build tab of the project's properties).

<Target Name="AddTsToContent" AfterTargets="CompileTypeScript" Condition="'$(BuildingProject)' != 'false'">
  <ItemGroup>
    <Content Include="@(TypeScriptCompile)" Condition="'$(TypeScriptSourceMap)' == 'true'"/>
  </ItemGroup>
</Target>

I placed this as the last element in <Project> of the .csproj file.