Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeScript definition files

I'm playing with TypesScript, but the compiler complains when I use browser types such as HTMLCanvasElement. I guess I need definition files for these types. I bet there is a repository of definition files for the DOM and for most popular frameworks, but Google has not been able to help me find it.

Do you guys know of such a repository?

like image 982
Robert Larsen Avatar asked Oct 29 '12 08:10

Robert Larsen


People also ask

Where do I put declaration files TypeScript?

Most of the libraries are bundled with a type declaration file of their own in their package distribution, which means once we install a package, we will get all type declaration files inside node_modules/<package-name>/lib . TypeScript uses this and does its magic.

Where does TypeScript look for Typings?

d. ts file is usually placed adjacent to the . ts file, it is providing the typings for. Although the ts compilers just match the files with the module names, by themselves even without placing them adjacent.


1 Answers

In addition to what @Christoffer has said for the DOM, @Boris Yankov has a really useful repository here: https://github.com/borisyankov/DefinitelyTyped with definition files for more than thirty, one hundred and thirty close to two hundred libraries(and counting!).

There's even a manager for the type definition files now: http://definitelytyped.org/tsd/ (Do not follow: link is now NSFW spam)

AND: Quite a lot of definition files are now on nuget: http://www.nuget.org/packages?q=TypeScript

like image 61
Jude Fisher Avatar answered Oct 22 '22 13:10

Jude Fisher