如何在TypeScript中获得jQuery自动补全功能? [英] How do I get jQuery autocompletion in TypeScript?

查看:59
本文介绍了如何在TypeScript中获得jQuery自动补全功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我正在处理TypeScript .ts文件,当我键入$字符时,我该怎么办才能获得jQuery Intellisense/自动完成功能?

If I'm working in a TypeScript .ts file, what can I do to get jQuery Intellisense/autocompletion when I type the $ character?

(我正在VS 2012中从事ASP.NET MVC 3项目.)

(I'm working in an ASP.NET MVC 3 project in VS 2012.)

推荐答案

您需要在.ts文件顶部添加对jQuery定义的引用.

You need to add a reference to the jQuery definition at the top of your .ts file.

/// <reference path="jquery.d.ts" />

您可以在jQuery 中找到类型注释此示例.

You can find type annotations for jQuery in this sample.

这篇关于如何在TypeScript中获得jQuery自动补全功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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