james
james

Reputation: 226

Upgrading Typescript Compiler for Visual Studio Project

I have an existing ASP.NET MVC project which uses typescript version 0.8 and I need to upgrade it to 1.5.

During the time of version 0.8 there was no <TypeScriptToolsVersion> element in the .csproj file but the following exists

  <PropertyGroup Condition="'$(Configuration)' == 'Release'">
    <TypeScriptTarget>ES5</TypeScriptTarget>
    <TypeScriptIncludeComments>false</TypeScriptIncludeComments>
    <TypeScriptSourceMap>false</TypeScriptSourceMap>
  </PropertyGroup>

So my question is this:

  1. If I include <TypeScriptToolsVersion>1.0</TypeScriptToolsVersion> do i still need <TypeScriptTarget>ES5</TypeScriptTarget>. I'm not sure if TS versions 1.0 - 1.5 above has the option to select specific ES version or it will just default to ES6.
  2. How do i know which Typescript version my typings uses (ex. jquery.d.ts). I can't seem to find anything in the source file that specifies its TS compiler version even looking at the github repo doesn't indicate its compiler requirements.
  3. Finally is there anyway to integrate the TS compiler in the project. We are using TFS Integration and we are not including the outputted js files (only the .ts) so we need to compile it during deployment. I could request for our devops to install the TS compiler in all our environments but that seems tedious. Using grunt may not work as well cause it would require me to request to install node in the prod environment. Any good approach would be appreciated.

Upvotes: 1

Views: 408

Answers (1)

ahz
ahz

Reputation: 950

  1. Yes tsc has option to select target since 0.8 to newest version. Default value is ES5 - I think in older version default was ES3.

  2. I just believe that typings authors create most compatible definitions possible. tsd is not versioned therefore you can only rely on build errors...

  3. Only deployment environments need to have tsc installed. You can install VS extension, use tsc itself (needs node) or use tools like grunt/gulp with some TS plugin. But in prod environment you don't need VS/node - it should use deployed version of the product with js files.

Upvotes: 2

Related Questions