Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use tsx error(使用 tsx 页面报错) #4303

Open
beixiyo opened this issue Apr 25, 2024 · 6 comments
Open

use tsx error(使用 tsx 页面报错) #4303

beixiyo opened this issue Apr 25, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@beixiyo
Copy link

beixiyo commented Apr 25, 2024

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>
@beixiyo
Copy link
Author

beixiyo commented Apr 25, 2024

Vue - Official:Version: v2.0.10 (is vscode latest)
Vscode - Version: 1.88.0(is vscode latest)

i am not use Prettier | ESLint | OtherVSCodeVueExtension
我没有使用任何无关插件

@so1ve so1ve added the bug Something isn't working label Apr 25, 2024
@so1ve
Copy link
Member

so1ve commented Apr 25, 2024

I'm able to reproduce this issue with the following steps:

  1. Create a new file (not sure why an existing file doesn't report this error)
  2. Paste the code
    image

BTW you have two <script setup> tags but the first one doesn't have an end tag.

@nsnans
Copy link

nsnans commented Apr 26, 2024

我在项目试了下,好像没问题,
image
"vue": "^3.2.47",
"@vitejs/plugin-vue-jsx": "^3.0.0",

@beixiyo
Copy link
Author

beixiyo commented Apr 26, 2024

我在项目试了下,好像没问题, image "vue": "^3.2.47", "@vitejs/plugin-vue-jsx": "^3.0.0",

image

{
    "vue": "^3.4.24",
    "vite": "^5.2.8",
    "@vitejs/plugin-vue-jsx": "^3.1.0",
    "Vue - Official": "v2.0.10",
    "VSCode": "1.88.0"
}

@nsnans
Copy link

nsnans commented Apr 26, 2024

我在项目试了下,好像没问题, image "vue": "^3.2.47", "@vitejs/plugin-vue-jsx": "^3.0.0",

image

{
    "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写

@beixiyo
Copy link
Author

beixiyo commented Apr 26, 2024

我在项目试了下,好像没问题, image "vue": "^3.2.47", "@vitejs/plugin-vue-jsx": "^3.0.0",

image

{
    "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写

image
禁用所有扩展也一样,vue 里写 tsx 仅仅是因为复用小的代码片段。写多了哪有 vue 可读性高

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants