react-component / react-component/slider

OnChange functions for range component with count value of -1 has Array<number | undefined> return type

Open
#457 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.1k
Forks
768
Avg merge
11d 22h
Merged PRs (30d)
5

Description

When the count prop is set to -1, the onChange, onAfterChange and onBeforeChange functions are passed a parameter of type [number, undefined]. Also, count values less than -1 result throw an exception. I propose that a better way to deal with this would be for the component to treat count values less than 1 like they were 1.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the range component's count handling and the callback type definitions, then reproduce the count=-1 and count<-1 cases. Done means callback parameters no longer expose an undefined range value for nonpositive counts, and invalid counts no longer throw unexpectedly; add or update focused tests if the repository provides them.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.