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

umi3.5+ts 使用keepAlive标签 编译器出现以下错误 怎么扩展一下ts声明 #74

Open
JayShen1943 opened this issue Aug 18, 2022 · 4 comments

Comments

@JayShen1943
Copy link

import { KeepAlive } from 'umi';
export default () => ( <KeepAlive> <Home /> </KeepAlive> );

image
image

@CJY0208
Copy link
Member

CJY0208 commented Aug 22, 2022

react 版本是18 吗

@JayShen1943
Copy link
Author

反应版本是18吗

17.x

@CJY0208
Copy link
Member

CJY0208 commented Aug 22, 2022

那可能是某些库导致 @types/react 版本升高了,18 版本的 react 类型发生了较大变化
需要在 package.json 中固定一下 @types/react 的版本到 17.x

{
  "resolutions": {
    "@types/react": "17"
  },
}

@AmorDiamond
Copy link

那可能是某些库导致 @types/react 版本升高了,18 版本的 react 类型发生了较大变化 需要在 package.json 中固定一下 @types/react 的版本到 17.x

{
  "resolutions": {
    "@types/react": "17"
  },
}

image
image

也遇到同样的问题,添加了该配置没有生效

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants