Picci
Picci

Reputation: 17752

VSCode Typescript Intellisense not working in the most simple project setup

I have been using VSCode intellisense happily since quite a long time.

Now I am doing something very simple: create a new project, add a package like rxJs and then start coding.

What I find is that intellisense is not working as it is used to.

In particular, if I just open a file like test.ts and add the following innocent code

of('abc'). // of is a function of rxJs

I get this response from intellisense

intellisense not giving the right support

At the same time if I start importing manually the function and do ctrl+space between the brackets I get the expected help.

here intellisense works

I am pretty sure I am missing something very basic, but after few hours of browsing I could not find any answer.

Here my tsconfig.json

{
    "compilerOptions": {
      "target": "es6",
      "module": "commonjs",
      "outDir": "dist",
      "sourceMap": true,
      "declaration": true,
      "noUnusedLocals": true,  
      "noUnusedParameters": true  
    },
    "include": [
      "src/*.ts",
      "src/**/*.ts"
    ],
    "exclude": [
      "node_modules"
    ],
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2016",
      "dom"
    ]
  }

Upvotes: 2

Views: 1657

Answers (2)

Jammar
Jammar

Reputation: 446

My intellisense started working again after removing my include and exclude settings in tsconfig, despite them being correct. Odd!

Upvotes: 0

basarat
basarat

Reputation: 276209

The function of needs to be imported for it to be available in the file.

Error:

of('abc'). // of is a function of rxJs

No error:

import {of} from 'rxjs';
of('abc'). // of is a function of rxJs

Upvotes: 0

Related Questions