monty.py
monty.py

Reputation: 2799

VS Code, typings - no IntelliSense

I have a project with the following (shortened) structure.

.
├── 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

As you can see, I have initialized and installed typings for the project.
However VS Code does not recognize the *.d.ts-files for IntelliSense.
So I do not get properly code completion, quick info etc.

tsconfig.json

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

jsconfig.json

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

I have read all related blogs and questions on this topic, but do not came across a working solution.

Upvotes: 2

Views: 1837

Answers (1)

monty.py
monty.py

Reputation: 2799

In the meantime (after hours of struggling) I came across my own solution.
Simply set the compiler option allowJs to true in tsconfig.json and save.

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

This is obviously a bug because it´s default is true according to the docs. I´ve posted this issue additionally on github.

Upvotes: 2

Related Questions