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

Add generic type to form values #15355

Merged
merged 1 commit into from Mar 13, 2019
Merged

Add generic type to form values #15355

merged 1 commit into from Mar 13, 2019

Conversation

@yesmeck
Copy link
Member

@yesmeck yesmeck commented Mar 12, 2019

First of all, thank you for your contribution! πŸ˜„

New feature please send pull request to feature branch, and rest to master branch.
Pull request will be merged after one of collaborators approve.
Please makes sure that these form are filled before submitting your pull request, thank you!

[δΈ­ζ–‡η‰ˆζ¨‘ζΏ / Chinese template]

πŸ€” This is a ...

  • New feature
  • Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Branch merge
  • Other (about what?)

πŸ‘» What's the background?

interface User {
  age: number;
  name: string;
}

interface Props extends FormComponentProps {
  user: User;
}

const UserForm: React.SF<Props> = () => {
  const handleSubmit = () => {
    form.validateFields((errors, values) => {
      console.log(values.notExist); // <= values has any type, no error
    })
  }
  ...
}

πŸ’‘ Solution

interface User {
  age: number;
  name: string;
}

interface Props extends FormComponentProps<User> {
  user: User;
}

const UserForm: React.SF<Props> = () => {
  const handleSubmit = () => {
    form.validateFields((errors, values) => {
      console.log(values.notExist); // <= values has type, error
    })
  }
  ...
}

πŸ“ Changelog description

Describe changes from user side, and list all potential break changes or other risks.

  1. English description

FormComponentProps added a generic type of form values.

  1. Chinese description (optional)

FormComponentProps ζ–°ε’ž Form ε€Όηš„θŒƒεž‹

β˜‘οΈ Self Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed
@netlify
Copy link

@netlify netlify bot commented Mar 12, 2019

Deploy preview for ant-design ready!

Built with commit d1f64b1

https://deploy-preview-15355--ant-design.netlify.com

@codecov
Copy link

@codecov codecov bot commented Mar 12, 2019

Codecov Report

Merging #15355 into master will increase coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #15355      +/-   ##
==========================================
+ Coverage   94.11%   94.14%   +0.03%     
==========================================
  Files         250      250              
  Lines        6643     6643              
  Branches     1927     1941      +14     
==========================================
+ Hits         6252     6254       +2     
+ Misses        390      388       -2     
  Partials        1        1
Impacted Files Coverage Ξ”
components/form/Form.tsx 88.88% <ΓΈ> (ΓΈ) ⬆️
components/upload/UploadList.tsx 96.33% <0%> (+1.83%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data
Powered by Codecov. Last update 97880a9...d1f64b1. Read the comment docs.

@afc163 afc163 merged commit 9102584 into master Mar 13, 2019
29 checks passed
29 checks passed
@netlify[bot]
Header rules No header rules processed
Details
@netlify[bot]
Pages changed 12 new files uploaded
Details
@github-actions[bot]
Auto Assign Auto Assign
Details
Codacy/PR Quality Review Up to standards. A positive pull request.
Details
LGTM analysis: JavaScript No new or fixed alerts
Details
License Compliance All checks passed.
Details
@netlify[bot]
Mixed content No mixed content detected
Details
@netlify[bot]
Redirect rules 18 redirect rules processed
Details
@wip[bot]
WIP Ready for review
Details
ant-design.ant-design #ant design succeeded
Details
ci/circleci: compile Your tests passed on CircleCI!
Details
ci/circleci: dist Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: setup Your tests passed on CircleCI!
Details
ci/circleci: test_dist Your tests passed on CircleCI!
Details
ci/circleci: test_dist_15 Your tests passed on CircleCI!
Details
ci/circleci: test_dom Your tests passed on CircleCI!
Details
ci/circleci: test_dom_15 Your tests passed on CircleCI!
Details
ci/circleci: test_es Your tests passed on CircleCI!
Details
ci/circleci: test_es_15 Your tests passed on CircleCI!
Details
ci/circleci: test_lib Your tests passed on CircleCI!
Details
ci/circleci: test_lib_15 Your tests passed on CircleCI!
Details
ci/circleci: test_node Your tests passed on CircleCI!
Details
ci/circleci: test_node_15 Your tests passed on CircleCI!
Details
codebeat no reportable quality changes
Details
@codecov[bot]
codecov/patch Coverage not affected when comparing 97880a9...d1f64b1
Details
@codecov[bot]
codecov/project 94.14% (+0.03%) compared to 97880a9
Details
@netlify[bot]
deploy/netlify Deploy preview ready!
Details
security/snyk - package.json (paranoidjk) No manifest changes detected
@delete-merged-branch delete-merged-branch bot deleted the form-generic-values branch Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants