小编sta*_*gt3的帖子

除非在每个文件中引用,否则无法在TS文件中找到名称"$"

我在Visual Studio 2015中设置了打字稿.我将使用带有TS文件的jquery.当我使用jquery时,VS会强调'$'并说无法找到名称,并且无法成功构建.它构建的唯一方法是在每个TS文件中添加对jquery typings的引用./// <reference path="typings/index.d.ts" /> 无论如何全局使用此引用而不是将其添加到每个文件?

在Visual Studio Code中我没有这个问题.

我的目录看起来像这样-scripts --ts --- typings --- main.ts tsconfig.json --js

我的tasks.json文件在root中

    {
    "version": "0.1.0",

    // The command is tsc. Assumes that tsc has been installed using npm install -g typescript
    "command": "tsc",

    // The command is a shell script
    "isShellCommand": true,

    // Show the output window only if unrecognized errors occur.
    "showOutput": "silent",

    // Tell the tsc compiler to use the tsconfig.json from the open folder.
    "args": ["-p", "../Scripts/Weblink/ts"],

    // …
Run Code Online (Sandbox Code Playgroud)

typescript visual-studio-2015

18
推荐指数
1
解决办法
2万
查看次数

标签 统计

typescript ×1

visual-studio-2015 ×1