【发布时间】:2019-06-05 18:08:04
【问题描述】:
我正在使用 VS Code 处理 Typescript 和 Vue Cli。我在这一行收到“定义缺失警告”:
import { setupCalendar, DatePicker } from "v-calendar";
找不到模块“v-calendar”的声明文件。
这个错误确实会影响 tsc 编译,但是 VS Code 总是在代码和导航栏显示这个错误
我可以做些什么来消除此错误并恢复我的“无错误”状态?
PS:v-calendar没有定义,是第三方导入的模块。
PS:这是我的“tsconfig.json”
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"esModuleInterop": true,
"strictPropertyInitialization": false,
"strictNullChecks": false,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": ".",
"types": ["webpack-env", "mocha", "chai"],
"paths": {
"@/*": ["src/*"]
},
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "tests/**/*.ts", "tests/**/*.tsx"],
"exclude": ["node_modules"]
}
【问题讨论】:
-
v-calendar 是在其他位置定义的文件吗?您可以使用相对路径来识别文件的位置。还是一个节点模块?
-
不,没有定义,是第三方导入的lib
标签: typescript visual-studio-code tsconfig