我已经开始使用 VSCode 0.7.0 并注意到注释说您不必再添加 ///
引用:
With the introduction of jsconfig.json, you no longer need to use /// references in each file (these were required in the initial versions of VS Code). As the file set is defined in jsconfig.json, VS Code knows what files and symbols are part of your project.
As an example, you can just drop a new type definition .d.ts file into your project folder and VS Code will pick it up automatically.
但是,我在 typings
文件夹中放置了很多这样的文件,而且 VSCode 似乎无法识别它们。有没有人有这方面的经验?
最佳答案
这是我正在使用的 jsconfig.json
文件:
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs",
"files": [
"typings/node/node.d.ts"
]
}
}
typings
文件夹位于项目根目录下的 jsconfig.json
文件旁边。
如果您在 nodejs 中突出显示一个未知的全局变量,例如 __dirname
然后点击 cmd+。 (ctrl+ . 在 PC 上?)然后选择 下载打字
它们将为您创建。
关于typescript - 在 VSCode 中包含 d.ts 类型定义文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32296299/