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: allow step prop to be null for typescript #691

Merged
merged 1 commit into from
Oct 2, 2020

Conversation

shangyilim
Copy link
Contributor

@shangyilim shangyilim commented Oct 2, 2020

When using null step Slider in Typescript, the linter complains that step cannot be null when used:

export default () => (
  <div>
       {/*Type 'null' is not assignable to type 'number | undefined'*/}
       <Slider step={null} /> 
    </div>
)

In the API is is clearly mentioned that step can be null:

Name Type Default Description
step number or null 1 Value to be added or subtracted on each step the slider makes. Must be greater than zero, and max - min should be evenly divisible by the step value.
When marks is not an empty object, step can be set to null, to make marks as steps.

This PR is to fix the type definition so that it doesn't show the error above.

@vercel
Copy link

vercel bot commented Oct 2, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/react-component/slider/t9szhadxc
✅ Preview: https://slider-git-fork-shangyilim-master.react-component.vercel.app

@codecov
Copy link

codecov bot commented Oct 2, 2020

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #691   +/-   ##
=======================================
  Coverage   88.11%   88.11%           
=======================================
  Files          10       10           
  Lines         690      690           
  Branches      182      182           
=======================================
  Hits          608      608           
  Misses         82       82           
Impacted Files Coverage Δ
src/Slider.tsx 92.22% <ø> (ø)

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 2a16c10...5bc425a. Read the comment docs.

@afc163 afc163 merged commit 38e22f1 into react-component:master Oct 2, 2020
jnachtigall added a commit to jnachtigall/slider that referenced this pull request Mar 24, 2021
This is the same like react-component#691 where it was fixed for `Slider` but `Range` seems to have been forgotten. Fixes react-component#739 react-component#652 react-component#574
afc163 pushed a commit that referenced this pull request Mar 25, 2021
This is the same like #691 where it was fixed for `Slider` but `Range` seems to have been forgotten. Fixes #739 #652 #574
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