相关疑难解决方法(0)

在 VSCode 中检查嵌套的 TypeScript 接口和类型

使用VSCodewith时,TypeScript我发现自己经常将鼠标悬停在函数或对象上以检查它们的类型。

通常,这些对象的类型和接口依赖于多个其他接口和类型。所以悬停不会提供太多信息。

要检查类型,我必须手动进入例如节点模块以查找类型声明并在那里检查它。

有没有办法轻松检查嵌套类型VSCode

下面是一个例子:

在此处输入图片说明

我想要一种简单的方法来检查React.FunctionComponent.

typescript visual-studio-code

6
推荐指数
1
解决办法
516
查看次数

如果文件未打开,Vscode 不会显示打字稿错误

我在本机反应上使用打字稿。当我的某个文件中有错误时,vscode 不会在“问题”选项卡中显示它,除非我打开了该文件。

打开文件之前: 文件未打开

打开文件后: 文件已打开

tsconfig.json:

{
  "extends": "@tsconfig/react-native/tsconfig.json"
}
Run Code Online (Sandbox Code Playgroud)

@tsconfig/react-native/tsconfig.json:

{
  "$schema": "https://json.schemastore.org/tsconfig",
  "display": "React Native",
  "_version": "2.0.3",
  "compilerOptions": {
    "target": "esnext",
    "module": "commonjs",
    "types": ["react-native", "jest"],
    "lib": [
      "es2019"
    ],
    "allowJs": true,
    "jsx": "react-native",
    "noEmit": true,
    "isolatedModules": true,
    "strict": true,
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "allowSyntheticDefaultImports": true,
    "forceConsistentCasingInFileNames": true,
    "esModuleInterop": true,
    "skipLibCheck": true
  },
  "exclude": [
    "node_modules",
    "babel.config.js",
    "metro.config.js",
    "jest.config.js"
  ]
}
Run Code Online (Sandbox Code Playgroud)

我该怎么做才能使所有错误都显示在问题选项卡中并且侧栏中的文件具有红色下划线?

typescript visual-studio-code

4
推荐指数
1
解决办法
1215
查看次数

标签 统计

typescript ×2

visual-studio-code ×2