Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

from 使用 mapPropsToFields 时, 类型检查不能通过 #15642

Closed
1 task
angular-moon opened this issue Mar 26, 2019 · 9 comments
Closed
1 task

from 使用 mapPropsToFields 时, 类型检查不能通过 #15642

angular-moon opened this issue Mar 26, 2019 · 9 comments
Assignees
Labels
🤔 Need Reproduce We cannot reproduce your problem

Comments

@angular-moon
Copy link

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

https://codepen.io/pen/?&editable=true&editors=001

Steps to reproduce

重现链接是antd官网的示例, 改写为typescript版本类型检查不能通过

What is expected?

修复返回类型的声明

What is actually happening?

typescript 类型检查不匹配

Environment Info
antd 3.15.1
React 16.8.0
System macos
Browser chrome 版本 73.0.3683.86(正式版本) (64 位)
@afc163 afc163 added the 🤔 Need Reproduce We cannot reproduce your problem label Mar 26, 2019
@ant-design-bot
Copy link
Contributor

Hello @angular-moon. Please provide a online reproduction by forking this link https://u.ant.design/codesandbox-repro or a minimal GitHub repository. Issues labeled by Need Reproduce will be closed if no activities in 7 days.

你好 @angular-moon, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 此处 创建一个 codesandbox 或者提供一个最小化的 GitHub 仓库。7 天内未跟进的 issue 将会被自动关闭。

@angular-moon
Copy link
Author

重现实例:
https://codesandbox.io/s/53zw9o0w64

@afc163
Copy link
Member

afc163 commented Mar 26, 2019

@angular-moon
Copy link
Author

interface UserFormProps extends FormComponentProps {
  onChange: Function;
  username: { [key: string]: any };
}

const UserForm: React.SFC<UserFormProps> 

我的意思是, UserForm 并不需要 onChange 和 username
Form.create 也不应该把2个props传递下去, 所以不应该在UserFormProps上声明这2个prop
可不可以通过Form.create 设置返回组件的Props
不知道我的理解对不对

@yesmeck
Copy link
Member

yesmeck commented Mar 26, 2019

@yesmeck
Copy link
Member

yesmeck commented Mar 26, 2019

CustomizedForm 的 props 类型是自动推导出来的,如果 CustomizedForm 的 props 要跟 UserForm 的 props 不一样,现在只能这么写。

@angular-moon
Copy link
Author

好的, 谢谢, 后续的版本会修改吗? mixin Form.create

@afc163
Copy link
Member

afc163 commented Mar 26, 2019

问题解决了先关了,欢迎继续讨论。

@afc163 afc163 closed this as completed Mar 26, 2019
@yesmeck
Copy link
Member

yesmeck commented Mar 26, 2019

后续 Form 的 API 改成 Hook 版本的话就不需要有个中间组件 CustomizedForm 存在了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤔 Need Reproduce We cannot reproduce your problem
Projects
None yet
Development

No branches or pull requests

4 participants