4

I am using older version of AngularJS - v1.3. Looking out for corresponding type-script definition files.

Will latest type-script definition be compatible with older library version?

https://www.nuget.org/packages/angularjs.TypeScript.DefinitelyTyped/

Its difficult to find mappings between Angular JS type-script definitions file version & Angular JS library version. Can we just go ahead with latest version of typescript definition available.

EDIT: I had to compare two nuget repositories & took a version where angular.d.ts comment changed from // Type definitions for Angular JS 1.3+ to // Type definitions for Angular JS 1.4+

3 Answers 3

3

Usually you can search for previous versions' definitions by running the following command with tsd:

tsd query angular -v all

Then install the specific version you want (ex. tsd install angular -v 1.0.0).

There's a problem though. For some reason there seems to be only two other versions of angular available:

- angularjs / angular
- angularjs / angular-v1.0.0
- angularjs / angular-v1.2.0

For that reason, I would suggest to take a look at the commit history of angular.d.ts and find the last definition file before it switched from 1.3 to 1.4. Knowing when Angular 1.4 was released helps.

By doing that, you will find this definition file for 1.3.

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

Comments

2

Use the ref attribute to specify the exact type definition file version, which corresponds to the branch on git. In your case you can use the below steps.

  1. Add the required tsd dependencies using

    tsd install angular --save

  2. The save step will create atsd.json file with below structure:

   {
     "version": "v4",
     "repo": "borisyankov/DefinitelyTyped",
     "ref": "master",
     "path": "typings",
     "bundle": "typings/tsd.d.ts",
     "installed": {
         "angularjs/angular.d.ts": {
            "commit": "77ec1408257c677f8fd8d6798ebaf6bd87c11b9d"
         }
     }
}

  1. Update the ref attribute to required angular type definition version. In your case most probably it should be 1.3.0

  2. Run tsd install again to download the required type definitions

Comments

0

What I have done is a bit like taking the long way and isn't exactly your scenario, but it worked for me and hopefully people in my situation will land here...

In my scenario I was ripping out NuGet as the typescript definition manager and replacing it with tsd and I needed a specific version of the lodash typescript definition (0.4.1) but tsd was installing the most recent version. Since versioning the way bower does it isn't yet supported upon install and tsd uses commit hashes to keep track of what version you're on, I used nuget to find the version I wanted:

NuGet Package Manager in Visual Studio

then replaced the "commit" hash in tsd.json with the git commit listed in the Description:

tsd.json file

It was a little painful because I had to type the hash in manually but it ensured that I had the version that I needed.

Comments

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.