1

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.

1 Answer 1

2
  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.

Sign up to request clarification or add additional context in comments.

3 Comments

Well that's a bummer. I guess the situation with with tsd will improve over time.
As for number 3 yes I'm aware that you don't need VS/node in the prod environment, but the issue is we are not checking in the js files. I guess what i'm saying that is that I don't have control over the machine who will do the build/deployment thus I can't control w/c extensions go into that build machine. What i'm looking for is a way to have the compiler built in to the project.
@james same here... I've prepared a script that downloads Node.js and npm from nodejs.org/dist (Node.js is relatively small and portable executable) and sets user's PATH var to use node. Then the script runs npm install and deployment env is prepared automatically - only needed is internet connection. Maybe tool like nvm can handle it too...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.