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

[bugfix] change function overload order in Form typescript define #12538

Merged
merged 1 commit into from
Oct 8, 2018
Merged

[bugfix] change function overload order in Form typescript define #12538

merged 1 commit into from
Oct 8, 2018

Conversation

TomIsion
Copy link
Contributor

@TomIsion TomIsion commented Oct 8, 2018

When I use with Form.create()() and this.props.form.validateFields with async/await in typescript:

this.prop.form.validateFields(async (errors, values) {
  // code here
  // writing sth need to block
  const a = await getInfo();
})

tslint always tell me: [ts] Parameter 'errors' implicitly has an 'any' type.

In typescript, async/await callback will conform these after typescript overload define:

validateFields(options: Object): void;
validateFields(callback: ValidateCallback): void;

The async/await func should use callback define firstly. Just like the above define in Form.d.ts:

validateFields(fieldNames: string[], callback: ValidateCallback): void;
validateFields(fieldNames: string[], options: Object): void;

So I change the order of the function overload define.

@codecov
Copy link

codecov bot commented Oct 8, 2018

Codecov Report

Merging #12538 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #12538   +/-   ##
=======================================
  Coverage   92.33%   92.33%           
=======================================
  Files         211      211           
  Lines        5542     5542           
  Branches     1599     1599           
=======================================
  Hits         5117     5117           
- Misses        419      421    +2     
+ Partials        6        4    -2
Impacted Files Coverage Δ
components/form/Form.tsx 95% <ø> (ø) ⬆️
components/transfer/index.tsx 87.91% <0%> (ø) ⬆️
components/time-picker/index.tsx 81.96% <0%> (ø) ⬆️

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 5bef1aa...e9c76f3. Read the comment docs.

@afc163 afc163 merged commit 4d48641 into ant-design:master Oct 8, 2018
@afc163 afc163 mentioned this pull request Oct 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants