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.

feat: Add type to ion-select interfaces

See original GitHub issue

Feature Request

The IonSelect and interface should allow us to define which value are we expecting.

Ionic version: [x] 5.x

Describe the Feature Request When working with CustomEvent’s that carry IonSelect as detail we have to always cast the value because the current type is any

  function newSoundType(event: CustomEvent<IonSelect>): void {
    const myValue = event.detail.value as MyType;  // Here value is any!
    this.updateTrainingConfigWith(myValue);
  }

Describe Preferred Solution The IonSelect interface should accept an optional T generic type, if none is given, then keep using any

Describe Alternatives Instead of using CustomEvent<IonSelect> one can also use CustomEvent<{value: MyType}> but then you can not be sure what is the source of that event.

Related Code Implementation using Interface with an value as an optional defined type

Implementation using Type instead of interface with a mapped NON Optional value


I wanted to create a PR but I was not sure where to edit this 😢

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
liamdebeasicommented, Jul 15, 2020

The core/api.txt file is basically a list of all of Ionic Framework’s public APIs. We use this when generating documentation and for keeping track of new features in the framework. Taking ion-input as an example, the “Properties”, “Events”, “Methods”, and “CSS Custom Properties” tables in the documentation (https://ionicframework.com/docs/api/input) are generated from this api.txt file.

We have a contributing guide that shows you how to make a PR, build the framework, lint, etc.

1reaction
liamdebeasicommented, Jul 15, 2020

Yesterday I merged a PR that adds this functionality 😊 . The feature should be available in an upcoming release of Ionic Framework: https://github.com/ionic-team/ionic-framework/commit/7c2d0c981ab91930478c4b76220ce4ec4ed4e471

Read more comments on GitHub >

github_iconTop Results From Across the Web

ion-select: Select One or Multiple Value Boxes or Placeholders
ion-select is represented by selected value(s), or a placeholder, and dropdown icon. When you tap select, a dialog box appears with an easy...
Read more >
Creating a content filter with Ionic components
Using Ionic UI components and TypeScript to filter search values in an associative array.
Read more >
Developers - feat: Auto scroll to selected item in ion-select -
feat : Auto scroll to selected item in ion-select.
Read more >
Styling ion-select with popover interface - css - Stack Overflow
You need to add some styles in your global.scss for popover-content :root { .popover-content { left: 0 !important; width: 100%; } }.
Read more >
abobander/wasim: Wasim is a web-based tool for semi-automatic ...
isRtl(project)}"></ion-input>; </ion-item>; <ion-item *ngFor="let feat of ... <ion-select [(ngModel)]="feat.value" interface="popover"> ...
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