next icon indicating copy to clipboard operation
next copied to clipboard

[ResponsiveGrid]初始化下面给组件ts 报错

Open haozi11 opened this issue 3 years ago • 4 comments

Component

ResponsiveGrid

Feature Description

'ResponsiveGrid' cannot be used as a JSX component. Its instance type 'ResponsiveGrid' is not a valid JSX element. The types returned by 'render()' are incompatible between these types. Type 'React.ReactNode' is not assignable to type 'import("C:/dev/nige/client/node_modules/@types/react-router/node_modules/@types/react/index").ReactNode'. Type '{}' is not assignable to type 'ReactNode'.ts(2786)

{
  "name": "@alifd/fusion-design-pro",
  "version": "0.1.0",
  "description": "使用 TypeScript,包含大量 UI 区块,比如图表、表单等。",
  "dependencies": {
    "@alifd/next": "^1.21.0",
    "moment": "^2.24.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-intl": "^2.8.0",
    "ahooks": "^2.0.0",
    "@alifd/theme-design-pro": "0.x",
    "bizcharts": "^3.5.6",
    "prop-types": "^15.5.8",
    "lodash.debounce": "^4.0.8",
    "react-sortablejs": "^5.0.0",
    "sortablejs": "^1.12.0"
  },
  "devDependencies": {
    "@iceworks/spec": "^1.0.0",
    "build-plugin-moment-locales": "^0.1.0",
    "eslint": "^7.30.0",
    "ice.js": "^2.0.0",
    "stylelint": "^13.2.0",
    "build-plugin-ignore-style": "^0.1.0",
    "@types/react": "^17.0.2",
    "@types/react-dom": "^17.0.2"
  },
  "scripts": {
    "start": "icejs start",
    "build": "icejs build",
    "lint": "npm run eslint && npm run stylelint",
    "eslint": "eslint --cache --ext .js,.jsx,.ts,.tsx ./",
    "eslint:fix": "npm run eslint -- --fix",
    "stylelint": "stylelint \"**/*.{css,scss,less}\""
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/alibaba-fusion/materials/tree/master/scaffolds/fusion-design-pro"
  },
  "private": true,
  "originTemplate": "@alifd/fusion-design-pro"
}

haozi11 avatar May 19 '22 16:05 haozi11

同样问题。按完了 fusign design pro,几乎导入的所有fusign design 组件都报这个错误,不仅仅是ResponsiveGrid一个组件。 image

aspirantzhang avatar May 24 '22 12:05 aspirantzhang

一样的问题

kurisu994 avatar May 27 '22 16:05 kurisu994

有人解决一下嘛?

haozi11 avatar Jun 11 '22 17:06 haozi11

之前问了因为@types/react更新了,fusion没更新。隔壁antd都支持react18了,这边连类型还没支持

sidely-zzx avatar Jul 15 '22 09:07 sidely-zzx

有没有解决办法

xmsz avatar Oct 14 '23 13:10 xmsz

这是因为项目内有多份 @types/react 版本且他们的类型定义不兼容导致的,可以通过 npm list @types/react 查看项目里依赖了哪些版本,然后根据你的包管理器配置锁定 @types/react 为一个固定版本即可。

npm标准: overrides yarn标准: resolutions

YSMJ1994 avatar Jan 30 '24 12:01 YSMJ1994

Stale

YSMJ1994 avatar Feb 22 '24 11:02 YSMJ1994