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


    3 thoughts on “SharePoint + TypeScript = Love

    1. What about CoffeScript?

      • Mike Chaliy says:

        I like CoffeeScript syntax, clean and readable. But many JS libs assume that you use JS. I was using CoffeeScript with Knockout.JS and result was quite alien. TS in this situation looks very good because TS is just extension to JS.

        Anyway, CoffeeScript has good integration to VisualStudio with Web Essentials 2012.

    Leave a Reply

    Fill in your details below or click an icon to log in: Logo

    You are commenting using your account. Log Out /  Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out /  Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out /  Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out /  Change )


    Connecting to %s