WebStorm无法识别嵌入式打字稿代码的字符串类型

时间:2018-08-19 09:56:59

标签: typescript types webstorm

对于当前最新的Webstorm,如果打字稿代码位于.ts文件中,则可以正常识别string类型。

但是如果嵌入了打字稿代码,则出了点问题。

.vue文件

typescript in vue

.html文件

tsx

tsconfig.json

由于上述错误提到了tsconfig.json,因此我将文件放在这里:

{
  "compilerOptions": {
    "target": "es5",
    "module": "esnext",
    "strict": true,
    "jsx": "preserve",
    "importHelpers": true,
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "baseUrl": ".",
    "types": [
      "node"
    ],
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    ]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "tests/**/*.ts",
    "tests/**/*.tsx"
  ],
  "exclude": [
    "node_modules"
  ]
}

如何配置WebStorm进行修复?

0 个答案:

没有答案