vscode 更新后 Typescript 项目找不到模块
Typescript project cannot find module after vscode update
每次我启动它更新时,VS 代码都在骚扰我,所以今天早上我做了,现在很多 ts 文件都找不到模块了。
许多文件都有这样的语句:
import Mustache = require("mustache");
这些文件没有这样的语句:
///<reference path="./typings/mustache.d.ts" />
但由于项目中的另一个文件有该语句,所以以前没有问题。不知何故;一旦我在某处引用了 "mustache",我就不需要在其他文件中重复这个过程,可以直接要求它。
我更新到:
Version 1.6.0
shell 1.3.7
node 6.5.0
如果有人能帮助解决这个问题,我将不胜感激。
task.json:
{
"version": "0.1.0",
"command": "tsc.cmd",
"isShellCommand": true,
"showOutput": "silent",
"problemMatcher": "$tsc"
}
节点 tsc:
C:\Users\me>tsc.cmd
Version 1.8.10
tsc.exe:
C:\Users\me>tsc.exe
Version 1.8.2
我在源目录的根目录下添加了一个index.d.ts,内容如下:
///<reference path="./typings/mustache.d.ts" />
///<reference path="./typings/jquery.2.1.3.d.ts" />
///<reference path="./typings/settings.typing.ts" />
但是文件仍然找不到 mustache,除非我自己在文件中添加类型定义。
卸载了 vs code 并重新安装但同样的问题(相同版本)
[更新]
已下载 1.5.3,所有问题都消失了
在源文件的基础上(即 src/ )制作一个包含所有 /// 的
的 index.d.ts 文件
这对我仍然有效:
版本 1.6.0
提交 e52fb0b...
渲染器 52.0
节点 6.5.0
您可以尝试 installing the second latest version 看看您在使用最新版本时遇到的问题是否仍然存在。
每次我启动它更新时,VS 代码都在骚扰我,所以今天早上我做了,现在很多 ts 文件都找不到模块了。
许多文件都有这样的语句:
import Mustache = require("mustache");
这些文件没有这样的语句:
///<reference path="./typings/mustache.d.ts" />
但由于项目中的另一个文件有该语句,所以以前没有问题。不知何故;一旦我在某处引用了 "mustache",我就不需要在其他文件中重复这个过程,可以直接要求它。
我更新到:
Version 1.6.0
shell 1.3.7
node 6.5.0
如果有人能帮助解决这个问题,我将不胜感激。
task.json:
{
"version": "0.1.0",
"command": "tsc.cmd",
"isShellCommand": true,
"showOutput": "silent",
"problemMatcher": "$tsc"
}
节点 tsc:
C:\Users\me>tsc.cmd
Version 1.8.10
tsc.exe:
C:\Users\me>tsc.exe
Version 1.8.2
我在源目录的根目录下添加了一个index.d.ts,内容如下:
///<reference path="./typings/mustache.d.ts" />
///<reference path="./typings/jquery.2.1.3.d.ts" />
///<reference path="./typings/settings.typing.ts" />
但是文件仍然找不到 mustache,除非我自己在文件中添加类型定义。
卸载了 vs code 并重新安装但同样的问题(相同版本)
[更新]
已下载 1.5.3,所有问题都消失了
在源文件的基础上(即 src/ )制作一个包含所有 /// 的
的 index.d.ts 文件这对我仍然有效:
版本 1.6.0 提交 e52fb0b... 渲染器 52.0 节点 6.5.0
您可以尝试 installing the second latest version 看看您在使用最新版本时遇到的问题是否仍然存在。