question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: ion-range event value is always type RangeValue {lower, upper}.

See original GitHub issue

Bug Report

Ionic version: [x] 4.x

Current behavior: The type of the ion-range value is always RangeValue ({ lower: number; upper: number; }).

Type 'RangeValue' is not assignable to type 'number'.
  Type '{ lower: number; upper: number; }' is not assignable to type 'number'.ts(2322)

Expected behavior: But by the docs it should be number OR RangeValue (number | { lower: number; upper: number; })

Steps to reproduce: Create a ion-range and append ionChange event. Please see related code…

Related code:

html

<ion-range
  (ionChange)="onRangeChange($event)"
  [min]="min"
  [max]="max"
  debounce="500"
></ion-range>

ts (error visible, see Current behavior section.)

onRangeChange(event: IonRange) {
  this.value = event.value;
}

Other information: Workaround: Cast to number. But maybe it’s unsafe.

I think it’s just a type definition issue.

Ionic info:

Ionic CLI :     5.2.8
Ionic Angular : 4.9.1
NodeJS :        v10.15.3
npm :           6.4.1
OS :            Windows 10
VSCode :        1.38.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
JumBaycommented, Apr 8, 2020

I can confirm this is still present in the latest @ionic/angular version (5.0.7)

0reactions
ionitron-bot[bot]commented, Jun 23, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Sliding Nightmare: Understanding the Range Input
The padding area is always transparent, while the border area and content-box are semitransparent (orange for the actual input , red for the ......
Read more >
<input type="range"> - HTML: HyperText Markup Language
elements of type range let the user specify a numeric value which must be no less than a given value, and no more...
Read more >
HTML5 input type range show range value - Stack Overflow
Show activity on this post. Note that this type of HTML input element has one hidden feature, such as you can move the...
Read more >
HTML input type="range" - W3Schools
The <input type="range"> defines a control for entering a number whose exact value is not important (like a slider control). Default range is...
Read more >
onChange event doesn't trigger when direclty clicking on the ...
When you directly after the loading choose the maximum value on the input type range, the event isn't fire with an onChange.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found