繁体   English   中英

VS代码,键入-没有IntelliSense

[英]VS Code, typings - no IntelliSense

我有一个具有以下(缩短的)结构的项目。

.
├── app
│   ├── app.css
│   ├── app.js
│   └── home
│       ├── home.css
│       ├── home.html
│       └── home.js
├── jsconfig.json
├── package.json
├── tsconfig.json
├── typings
│   ├── globals
│   │   ├── jquery
│   │   │   ├── index.d.ts
│   │   │   └── typings.json
│   │   └── office-js
│   │       ├── index.d.ts
│   │       └── typings.json
│   └── index.d.ts
└── typings.json

如您所见,我已经初始化并安装了该项目的类型。
但是,VS Code无法识别IntelliSense的* .d.ts文件。
所以我没有得到正确的代码完成,快速信息等。

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs"
  },
  "files": [
    "typings/index.d.ts"
  ]
}

jsconfig.json

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs"
    },
    "exclude": [
        "node_modules"
    ]
}

我已经阅读了有关此主题的所有相关博客和问题,但没有遇到有效的解决方案。

在此期间(经过数小时的奋斗),我遇到了自己的解决方案。
只需在tsconfig.json中将编译器选项allowJs设置为true并保存。

{
  "compilerOptions": {
    "target": "ES5",
    "module": "commonjs",
    "allowJs": true
  }
}

根据文档,这显然是一个错误,因为它的默认值为true。 我在github上另外发布了此问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM