kripod / kripod/react-polymorphic-types
forwardRef and memo examples don't work with Typescript 5.1
- 主要语言
- 没有语言数据
- 星标
- 197
- 派生
- 9
- PR 合并指标
- 30 天内没有已合并 PR
描述
Hello!
I tried to update our typescript to 5.1 and now we are seeing errors on our usage of `PolymorphicForwardRefExoticComponent`. The same error also happens with `PolymorphicMemoExoticComponent`
It also errors on playground using the example from the package: [TS Playground with Error](https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAKjgQwM5wEoFNkGN4BmUEIcARFDvmQNwCwAUKJLHDAJ5hZwDejccAAoQANuxDQwAC2C4AYtADuyKABNsBAKIAPCDFkBhEpAB2WEzAA0-IaPGSZuQcTCoA6sBhSIAVxgbrBgFhMQkoaVlnCFcPLw1GAF84IhJySjwYAFpIUIdZTI4uVFpGAHpSuGZoeB44AAkcVWATAHMAESwCZB8RGE0RLBBzK3rG5paAeUUTKNc4JJTSMgA6UobkJtaShkZcCBNUeHXN9s7u3v7B4bgAXjgAcikAJnvGQu5j8amZl3Q7viCcD2ImgAH4AFxwQ5Qcb0BgJOGMLDaFjwd6jDbjWaoAA8NgAKnBkTBzKp0NgMstLkMLPjONw7u8IAQMScOl0en0BjSYIwAHy3Wy5cKObGxKQaHGfVrfbGWOD4vmIhjI1FA-aHVnjSEhewi2QKKDKNQaHR6QzGfbDPGA6WTaZymxMll29nnLlXCz8wUU-DLAhKFTqToACgIPhM+GA+y1rRtAkJxNJ5KoMCp3OGdK4gudsdOHIuGa9DD5IZsAIEAjQgUr6pBUBrlcO7AGjYEyw7lEO2JsCR1djCEScv3Fvn8nSlYxlDt+8sVjcoBEhvrThuNqiwwYIOOpwz5jAAlLwbHsDvBdxZl6n056YFmGSh0AAfJ95t2ci8wOECSgwHxQEw4B3It4EXG4eEXJJmwGcDamBaB5Q7ZZoO4BIkh4JCuxgbEklKJVEgPGggA)
Full Error is:
```ts
Type 'ForwardRefExoticComponent, "ref"> | Omit, HTMLObjectElement>, "ref"> | ... 121 more ... | Omit<...>, "as" | "color"> & HeadingOwnProps & { ...; } & RefAttributes<...>>' is not assignable to type 'PolymorphicForwardRefExoticComponent'.
Type 'ForwardRefExoticComponent, "ref"> | Omit, HTMLObjectElement>, "ref"> | ... 121 more ... | Omit<...>, "as" | "color"> & HeadingOwnProps & { ...; } & RefAttributes<...>>' is not assignable to type ' = "h2">(props: PolymorphicPropsWithRef) => ReactElement> | null'.
Type 'ReactNode' is not assignable to type 'ReactElement> | null'.
Type 'undefined' is not assignable to type 'ReactElement> | null'.
```
my lib versions are:
Typescript: 5.1.3
@types/react: 18.2.14
@types/react-dom: 18.2.6
Thank you
贡献指南
这个仓库没有索引到贡献指南
调研方向
从链接的 TypeScript Playground 以及使用 PolymorphicForwardRefExoticComponent 和 PolymorphicMemoExoticComponent 的定义或示例开始。使用 TypeScript 5.1.3、@types/react 18.2.14 和 @types/react-dom 18.2.6 重现这些错误,然后确定这些示例不再通过类型检查的原因。当 forwardRef 和 memo 示例都能在没有所报告的 ReactNode 错误的情况下编译时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- react, typescript
- 领域
- frontend
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100