gpt4 book ai didi

reactjs - Flowtype 传播运算符不起作用

转载 作者:行者123 更新时间:2023-12-02 03:53:23 25 4
gpt4 key购买 nike

这里是 FLOW bin 的链接,其中包含一个工作版本,但似乎仍然无法工作。函数正在获取应使用扩展运算符传递的未定义参数。当您打开链接时,我所说的错误是#78。

--> Flow Bin

enter image description here我似乎无法让展开运算符与 Flow 一起使用。我在这里做错了什么吗?我使用最新版本的 Webstorm 和“flow-bin”:“^0.48.0”。任何帮助将不胜感激!谢谢

type Actions = {
authenticateUser: (formProps: RegisterUserProps) => Dispatch,
errorMessage: string,
handleSubmit: any,
valid: boolean
}

type Props = {
...Actions
}

这段代码只是让我的 IDE 认为没有任何内容被传递到 Props 中 - 所以我在 Actions 中的每种类型上都会收到错误。

最佳答案

这里有一个讨论这个问题的帖子:https://github.com/facebook/flow/issues/3534

您可以使用以下方法暂时解决此问题

type Props = {
...$Exact<Actions>
}

type Actions = {|
authenticateUser: (formProps: RegisterUserProps) => Dispatch,
errorMessage: string,
handleSubmit: any,
valid: boolean
|}

关于reactjs - Flowtype 传播运算符不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44767959/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com