问题
Are there any other possibilities to get TypeScript type definitions then copy from the useful DefinitelyTyped Repo or using NuGet? Maybe bower or something like that?
回答1:
It is possible with bower.
First install bower by using npm:
npm install -g bower
Then install DefinitelyTyped by using bower:
bower install DefinitelyTyped
回答2:
The best option is to use tsd
. It is like npm
or bower
, but for typescript definitions
npm install tsd@next -g
cd path/to/your/project
tsd init
Then
tsd install jQuery --save
That's it.
EDIT
There is a new TypeScript definition manager, typings, with the goal of non-ambient type definitions used by external modules.
EDIT
With the future TypeScript 2, you will be able to install type definitions with npm install @types/jQuery
回答3:
They can be installed via nuget e.g. https://www.nuget.org/packages/jquery.TypeScript.DefinitelyTyped/
This also may be of use:
https://github.com/DefinitelyTyped/tsd
来源:https://stackoverflow.com/questions/28602879/get-typescript-definition-files-via-bower