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

fix: InputNumber onChange type #23871

Merged
merged 1 commit into from
May 5, 2020
Merged

fix: InputNumber onChange type #23871

merged 1 commit into from
May 5, 2020

Conversation

jjhbw
Copy link
Contributor

@jjhbw jjhbw commented May 5, 2020

🤔 This is a ...

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

🔗 Related issue link

The type of InputNumber's onChange function was incomplete, leading to confusion and TypeErrors when used the wrong way. Fixes: #12795, which may have been prematurely closed.

Would be great if this could also be backported to 3.x! ❤️

💡 Background and solution

Simply extended the union type, as explained by #12795 (comment)

📝 Changelog

As this is just a correction of the typedef I do not expect any breaking changes. Users may need to adjust their downstream code a bit to please the typechecker.

Language Changelog
🇺🇸 English
🇨🇳 Chinese

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • 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

@ant-design-bot
Copy link
Contributor

ant-design-bot commented May 5, 2020

@codesandbox-ci
Copy link

codesandbox-ci bot commented May 5, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 44b063e:

Sandbox Source
antd reproduction template Configuration

@codecov
Copy link

codecov bot commented May 5, 2020

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #23871   +/-   ##
=======================================
  Coverage   98.56%   98.56%           
=======================================
  Files         364      364           
  Lines        7272     7272           
  Branches     2027     2028    +1     
=======================================
  Hits         7168     7168           
  Misses        104      104           
Impacted Files Coverage Δ
components/input-number/index.tsx 100.00% <ø> (ø)

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 97fde3a...44b063e. Read the comment docs.

@afc163 afc163 changed the title Fix for #12795: InputNumber onChange type fix: InputNumber onChange type May 5, 2020
@afc163 afc163 merged commit 5c8ffd4 into ant-design:master May 5, 2020
@ycjcl868 ycjcl868 mentioned this pull request May 11, 2020
@letuan1206
Copy link

I don't understand why InputNumber addition type string?

@jjhbw
Copy link
Contributor Author

jjhbw commented Jun 8, 2020

@letuan1206 see #12795

InputNumber's onChange may return a string. This is weird behaviour IMO, but until this is fixed the type defs need to reflect this fact.

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.

[Bug] InputNumber return an empty string '' when it was cleared
4 participants