Integre Jquery in Typescript



我在Typescript中集成了Jquery,但我有这个错误:

错误 TS2304:找不到名称"JQueryStatic"。

config.json:

{
"compilerOptions": {
"target": "es5",
"pretty": true,
"experimentalDecorators":true
},
"files": [
"demo.ts",
"typings/index.d.ts"
],
"excluse": ["node_modules"]
}

演示.ts:

declare var $: JQueryStatic;
$('.test').click(function(eventObject){
alert('hello');
})

这是我项目的屏幕:

在此处输入图像描述

我在打字稿中集成了Jquery,但我有这个错误:

只需使用@types.运行:npm install @types/jquery -D.

更多

https://basarat.gitbooks.io/typescript/docs/types/migrating.html

最新更新