🐛 fix: fix types due to father build error #109
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
背景
@types/react
最新(18.2.x)的返回是 ReactNode ,而之前的老版本则是返回的ReactElement
。当使用 IDE 版本为ts <=5.0
时, FC 使用的类型是 ts5.0 文件夹下的index.d.ts
,一定会走到老版本。而 father 4.3.4 的版本加入了相应的强校验,且依赖的 ts 版本为
5.0.4
,导致react 声明无法匹配,构建会报错。解决方案
将类型从
ReactNode
改为ReturnType<FC>