ant-design / ant-design-pro

👨🏻‍💻👩🏻‍💻 Use Ant Design like a Pro!
https://pro.ant.design
MIT License
36.34k stars 8.14k forks source link

🐛[BUG] update `jsx: "react"` into `jsx: "react-jsx"` to suport the new JSX transform in React 17 in tsconfig.json #7698

Closed hihuangwei closed 3 years ago

hihuangwei commented 3 years ago

🐛 bug 描述

update `jsx: "react"` into `jsx: "react-jsx"` to suport the new JSX transform in React 17 in tsconfig.json

© 版本信息

chenshuai2144 commented 3 years ago

vsocde 还没准备好,等vscode 准备好了就可以修改默认配置了

shirlyzs commented 3 years ago

请问这个怎么解决的

chenshuai2144 commented 3 years ago

先忽略 等vscode发版本

Leskur commented 3 years ago

解决方法:

确保 typescript 的依赖安装完成,随便打开一个提示错误的 .tsx 文件。

macOS 使用 command + shift + p,Windows 貌似是 ctrl + shift + p 。

然后输入 TypeScript ,不出意外的话你会看到 Select Typescript Version 选项。 选择 node_modules 下的那个版本(一般来说都会比较新)。

一般来说就没有问题了。

james70s commented 3 years ago

// tsconfig.json

"compilerOptions": {

"module": "esnext",
"target": "esnext",
"jsx": "react-jsx",    // 改成该配置

}