Category Archives: TypeScript

SharePoint + TypeScript = Love

Few months ago I became SherePoint developer, and this is like developing in damn stone age. No async, no SignalR, no .. , actually there almost nothing from last years. Mad. If you need something post 2008, you are out of lack. But this is like 8-bit game. You know this feeling of playing games on ZX-Spectrum? So let’s play.

  • Obviously, you need install TypeScript. It will ask restart everything, I also restarted few servers, just in case.
  • Create new TS file (for example in Layouts folder), you need to use Add New Item dialog, because otherwise VisualStudio will not assign (and will not allow you)  TypeScriptCompile to Build Action property of the file. image
  • Try to compile. File.js under File.ts should be JavaScript compiled from TypeScript. For me it does not work however. Fix is here.  You just need to add BeforeBuild target to call compiler. Make sure that path to compiler is correct.
  • Try compile another time. This time it should work.
  • After I got this working, level of impression raised exponentially. Writing JavaScriptTypeScript became much more pleasant.

    Some missing points:

    1. Somehow I need remove TS files from result WSP file.
    2. I need better way to manage TypeScript definition files in solution, but this is general problem of how integrate NuGet content packages to SharePoint project.

    Overall impression is 4.5 from 5

    Advertisements