umi-plugin-keep-alive icon indicating copy to clipboard operation
umi-plugin-keep-alive copied to clipboard

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

Open JayShen1943 opened this issue 2 years ago • 4 comments

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

image image

JayShen1943 avatar Aug 18 '22 06:08 JayShen1943

react 版本是18 吗

CJY0208 avatar Aug 22 '22 01:08 CJY0208

反应版本是18吗

17.x

JayShen1943 avatar Aug 22 '22 01:08 JayShen1943

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

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

CJY0208 avatar Aug 22 '22 01:08 CJY0208

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

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

image image

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

AmorDiamond avatar Nov 29 '22 10:11 AmorDiamond