Site icon Knarfalingus.net

TYPESCRIPT PLUNGE

My plunge into TypeScript is to convert an existing proprietary ASP.NET Control Class Library, that uses C# on the server side, and Javascript on the client side from Javascript to TypeScript.   Although this library is in production use daily, there hasn’t been significant development on it  since it was first created back in the 2006-2007 timeframe.  As such, it is packed with older style Javascript.   There is also zero jQuery usage.  After the conversion, I expect another developer at my company may be able to modify it! (safely!).  The amount of code is not insignificant, there are about 20,500 total lines of Javascript spread across several files. Although I won’t post any of this closed source code here, I will put up some pseudo code that illustrates what I encounter.

The next step is to get TypeScript to work in a class library project, by default it does not.  This can be achieved be editing the project file in a text editor and changing the below from

  <Import Project="$(MSBuildBinPath)Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->

to

  <Import Project="$(MSBuildBinPath)Microsoft.CSharp.targets" />
  <Import Project="$(MSBuildExtensionsPath32)MicrosoftVisualStudiov$(VisualStudioVersion)TypeScriptMicrosoft.TypeScript.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
Exit mobile version