2017-02-28 10 views
0

我在2015年VS(與打字稿HTML應用程序)創建的打字稿項目@類型/ jQuery的錯誤 'jQuery的' 不確定

套餐:

{ 
    "version": "1.0.0", 
    "name": "asp.net", 
    "private": true, 
    "devDependencies": { 
    "@types/jquery": "^2.0.40" 
    } 
} 

ts.config:

{ 
    "compilerOptions": { 
    "noImplicitAny": false, 
    "noEmitOnError": true, 
    "removeComments": false, 
    "sourceMap": true, 
    "target": "es5", 
    "module": "umd", 
    "typeRoots": [ 
     "node_modules/@types" 
    ], 
    "types": [ "jquery" ] 
    }, 
    "exclude": [ 
    "node_modules", 
    "wwwroot" 
    ] 
} 

test.ts:

jQuery(document).ready(() => {} 

When我運行的應用程序,它拋出'jQuery'是未定義的。

有什麼問題?

注:有一個在node_modules文件夾和代碼反思@types文件夾中工作正常(如jquery的類型它提示阿賈克斯,綁定等..

回答

0

不要忘記在最上面一行添加import $ from 'jquery'命令。您的代碼

相關問題