typescript Intellisense 没有显示变量的类型或带我去定义

typescript Intellisense is not showing the type of the variable or taking me to the definition

我通常使用 javascript,当鼠标悬停在导入或变量名称上时,它会显示类型和任何文档。

当点击变量或导入时,即使它在 node_modules 或在 C:/Users/user/AppData/Local/Microsoft/TypeScript ...

的 core-js 中,它也会将您带到定义处

如第一张照片所示,

在 javascript 上:

在 typescript 文件上,这不起作用,如图所示:

如何进行这项工作?

我已经安装了所有 @types。但这要么是 tsconfig 的问题,要么我需要安装某种扩展程序,但不知道哪一个正是我需要的。

tsconfig:

{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "rootDir": "./",
    "outDir": "./build",
    "esModuleInterop": true,
    "strict": true
  }
}

在您删除问题之前,我尝试从 vs-code 网站获取答案,但没有任何回应。

感谢@tHeSiD

使用 import 语句而不是 require 解决了问题。