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

view不能用作jsx组件 版本为3.4.13 #12029

Closed
amzeshan opened this issue Jul 4, 2022 · 17 comments
Closed

view不能用作jsx组件 版本为3.4.13 #12029

amzeshan opened this issue Jul 4, 2022 · 17 comments
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x
Projects

Comments

@amzeshan
Copy link

amzeshan commented Jul 4, 2022

相关平台

H5

复现仓库

https://github.com/amzeshan/taro
浏览器版本: Edge 103.0.1264.44
使用框架: React

复现步骤

git clone https://github.com/amzeshan/taro.git
npm install
即可重现

期望结果

解决ts校验问题

实际结果

报错

环境信息

👽 Taro v3.4.13


  Taro CLI 3.4.13 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 14.17.3 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
      npm: 6.14.13 - C:\Program Files\nodejs\npm.CMD

补充信息

最新版本依然报错

@taro-bot2 taro-bot2 bot added F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x labels Jul 4, 2022
@TheKonka
Copy link
Member

TheKonka commented Jul 4, 2022

我也遇到了

@Chen-jj
Copy link
Contributor

Chen-jj commented Jul 4, 2022

@amzeshan @konka-king 没有复现喔

image

@amzeshan
Copy link
Author

amzeshan commented Jul 4, 2022

你好,如图所示为typescript版本

SharedScreenshot

@amzeshan
Copy link
Author

amzeshan commented Jul 4, 2022

@Chen-jj 同jsx未报错

@Chen-jj
Copy link
Contributor

Chen-jj commented Jul 4, 2022

所以是报了还是没报。。原问题是指哪里的问题?

@amzeshan
Copy link
Author

amzeshan commented Jul 4, 2022

创建项目时选择使用typescript则报错,不使用typescript则不报错

@Chen-jj
Copy link
Contributor

Chen-jj commented Jul 4, 2022

@amzeshan 更新一下 demo 仓库吧,提供一个可复现的

@amzeshan
Copy link
Author

amzeshan commented Jul 4, 2022

已更新,地址为https://github.com/amzeshan/taro_tsx.git @Chen-jj

@Chen-jj
Copy link
Contributor

Chen-jj commented Jul 4, 2022

image

@amzeshan 仍然没有问题喔

@Chen-jj
Copy link
Contributor

Chen-jj commented Jul 4, 2022

@amzeshan 参考一下这个 issue 的评论,看看依赖的版本有没有问题?

@amzeshan
Copy link
Author

amzeshan commented Jul 4, 2022

这个我参考过,没有效果。目前我的解决方式是使用低版本的cli比如3.3.12是不会出现这个问题,谢谢你的解答,我换个版本
@Chen-jj

@amzeshan amzeshan closed this as completed Jul 4, 2022
@Chen-jj
Copy link
Contributor

Chen-jj commented Jul 4, 2022

Demo 带 yarn.lock,我和你的项目依赖是一样的。与全局 CLI 也无关,因为是 VSCode 开发时报的 TS 错误。或许可以重启下 VSCode。。

@huanlirui
Copy link

同样的问题。vscode编辑器 对所有view text 等taro组件报错。其他taro项目又是正常的。奇了怪

@ZakaryCode ZakaryCode added this to Done in H5 Aug 22, 2022
@leishihong
Copy link

针对这个问题发现如果使用了状态管理redux需要把依赖的react-redux版本指定为7.2.0 不要使用最新的即可解决掉

1 similar comment
@leishihong
Copy link

针对这个问题发现如果使用了状态管理redux需要把依赖的react-redux版本指定为7.2.0 不要使用最新的即可解决掉

@miaojinsing
Copy link

同样遇到,用的是pnpm

@Skedush
Copy link

Skedush commented May 8, 2024

再tsconfig.ts中加

"paths": {
      "react": ["./node_modules/@types/react"]
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x
Projects
Archived in project
H5
  
Done
Development

No branches or pull requests

7 participants