TypeScript定义文件 [英] TypeScript definition files

查看:112
本文介绍了TypeScript定义文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用TypesScript,但是当我使用HTMLCanvasElement之类的浏览器类型时,编译器会抱怨.我想我需要这些类型的定义文件. 我敢打赌,这里有一个DOM和大多数流行框架的定义文件存储库,但是Google却无法帮助我找到它.

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?

推荐答案

源中包含的lib.d.ts(

The lib.d.ts that is included in the source (http://typescript.codeplex.com/SourceControl/changeset/view/fe3bc0bfce1f#bin%2flib.d.ts) contains definitions for most of the DOM related stuff. If you are using Visual Studio, you should consider downloading the tools which includes a template where lib.d.ts is bundled.

如果缺少任何内容,我认为您可以使用declare语法.

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

这篇关于TypeScript定义文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆