簡體   English   中英

VSCode Typescript Intellisense在最簡單的項目設置中不起作用

[英]VSCode Typescript Intellisense not working in the most simple project setup

自從很長一段時間以來,我一直在愉快地使用VSCode智能感知。

現在,我做的事情非常簡單:創建一個新項目,添加一個類似於rxJs的包,然后開始編碼。

我發現,智能感知無法像過去那樣正常工作。

特別是,如果我只是打開一個像test.ts這樣的文件並添加以下無辜的代碼,

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

我從智能感知中得到了這個回應

智能感知沒有給予正確的支持

同時,如果我開始手動導入函數,並在方括號之間進行ctrl+space ,則會獲得預期的幫助。

這是智能工作

我很確定我缺少一些基本的知識,但是經過幾個小時的瀏覽后我找不到任何答案。

這是我的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"
    ]
  }

該功能of需要進口它是在文件中供。

錯誤:

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

沒有錯誤:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM