javascript 为什么TypeScript在Visual Studio Code中无法正常工作?

cbjzeqam  于 4个月前  发布在  Java
关注(0)|答案(1)|浏览(66)

我在vscode中得到错误,但一切都正常工作。一些错误:
第一个月

[{
    "resource": "/C:/Users/Dell/Desktop/vite-project/src/App.tsx",
    "owner": "typescript",
    "code": "1110",
    "severity": 8,
    "message": "Type expected.",
    "source": "ts",
    "startLineNumber": 10,
    "startColumn": 6,
    "endLineNumber": 10,
    "endColumn": 7
}]

字符串
Cannot find name 'div'.'>' expected..


的数据


d8tt03nd

d8tt03nd1#

我可以通过更新我的tslog.json文件中的“jsx”设置来解决这个问题。最初,它被设置为“jsx”:“react”,但将其更改为“jsx”:“preserve”为我解决了这个问题。下面是来自我的tsconfig.json的更新片段:

{
  "compilerOptions": {
    // ...
    "jsx": "preserve"
  }
}

字符串
此外,我更新了TypeScript版本以使用工作区版本。

相关问题