TypeScript definition files

I play with TypeScript, but the compiler complains when I use browser types like HTMLCanvasElement. I think I need definition files for these types. I'm sure there is a repository of definition files for the DOM and for most of the popular frameworks, but Google could not help me find it.

Do you guys know about such a repository?

+8
typescript
source share
2 answers

lib.d.ts , which is included in the source code ( http: // typescript.codeplex.com/SourceControl/changeset/view/fe3bc0bfce1f # bin% 2flib.d. ts ) contains definitions for most DOM-related materials. If you are using Visual Studio, you should consider downloading tools that include a template into which lib.d.ts inserted.

If nothing is missing, I think you can use the declare syntax.

+11
source share

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

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

And : quite a few definition files now in nuget: http://www.nuget.org/packages?q=TypeScript

+27
source share

All Articles