language-tools
language-tools copied to clipboard
use tsx error(使用 tsx 页面报错)
Vue - Official:Version: v2.0.10 (is vscode latest) Vscode - Version: 1.88.0(is vscode latest)
i am not use Prettier | ESLint | OtherVSCodeVueExtension
我没有使用任何无关插件
vite.config.ts
import vueJsx from '@vitejs/plugin-vue-jsx'
export default defineConfig({
plugins: [
vue(),
vueJsx(),
]
})
ErrorFile.vue
(报错的文件内容)
<script setup lang="tsx">
function Splitor() {
/** 运算符“>”不能应用于类型“string”和“RegExp”。ts-plugin(2365) */
return (<span style="margin: 0px 7px">/</span>)
}
</script>
Vue - Official:Version: v2.0.10 (is vscode latest) Vscode - Version: 1.88.0(is vscode latest)
i am not use Prettier | ESLint | OtherVSCodeVueExtension
我没有使用任何无关插件
I'm able to reproduce this issue with the following steps:
- Create a new file (not sure why an existing file doesn't report this error)
- Paste the code
BTW you have two <script setup>
tags but the first one doesn't have an end tag.
我在项目试了下,好像没问题,
"vue": "^3.2.47",
"@vitejs/plugin-vue-jsx": "^3.0.0",
我在项目试了下,好像没问题,
"vue": "^3.2.47", "@vitejs/plugin-vue-jsx": "^3.0.0",
{
"vue": "^3.4.24",
"vite": "^5.2.8",
"@vitejs/plugin-vue-jsx": "^3.1.0",
"Vue - Official": "v2.0.10",
"VSCode": "1.88.0"
}
我在项目试了下,好像没问题,
"vue": "^3.2.47", "@vitejs/plugin-vue-jsx": "^3.0.0",
{ "vue": "^3.4.24", "vite": "^5.2.8", "@vitejs/plugin-vue-jsx": "^3.1.0", "Vue - Official": "v2.0.10", "VSCode": "1.88.0" }
新建了个项目,一样版本,没问题,可能是其他拓展引起的。为什么不直接使用tsx文件写呢?感觉vue文件里面写好麻烦,导出函数什么的还会报错,我项目就是全部tsx写
我在项目试了下,好像没问题,
"vue": "^3.2.47", "@vitejs/plugin-vue-jsx": "^3.0.0",
{ "vue": "^3.4.24", "vite": "^5.2.8", "@vitejs/plugin-vue-jsx": "^3.1.0", "Vue - Official": "v2.0.10", "VSCode": "1.88.0" }
新建了个项目,一样版本,没问题,可能是其他拓展引起的。为什么不直接使用tsx文件写呢?感觉vue文件里面写好麻烦,导出函数什么的还会报错,我项目就是全部tsx写
禁用所有扩展也一样,vue 里写 tsx 仅仅是因为复用小的代码片段。写多了哪有 vue 可读性高
TypeScript reported an internal error when I debugging this:
'False expression: Script kind should match provided ScriptKind:3 and sourceFile.scriptKind: 4, !entry: false'
3
is TS and4
is TSX
Not sure if this is related. But this error corresponds to "an existing file doesn't report this error" as said in https://github.com/vuejs/language-tools/issues/4303#issuecomment-2076695749.