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

bug: InputInputEventDetail is not exported from ionic react #29518

Closed
3 tasks done
filifunk opened this issue May 16, 2024 · 3 comments · Fixed by #29512
Closed
3 tasks done

bug: InputInputEventDetail is not exported from ionic react #29518

filifunk opened this issue May 16, 2024 · 3 comments · Fixed by #29512
Assignees
Labels

Comments

@filifunk
Copy link
Contributor

Prerequisites

Ionic Framework Version

v8.x

Current Behavior

The type InputInputEventDetail is not importable to be used in an onIonInput component.

Expected Behavior

We should be able to import like this:

import type { InputInputEventDetail } from '@ionic/react

That way the user should be able to use that as a type.

Steps to Reproduce

  1. Use Ionic/React and TypeScript.

  2. Use an IonInput component and then use onIonInput parameter.

  3. Use an event function. When hovering over the event it says that it is of type IonInputCustomEvent<InputInputEventDetail>.

  4. Try to type it as <InputCustomEvent<InputInputEventDetail>>. The error is Cannot find name InputInputEventDetail

  5. Try to import the type:

import type { InputInputEventDetail } from '@ionic/react'

The error will be Module '@ionic/react' has no exported member 'InputInputEventDetail'

Code Reproduction URL

https://ionic-react-first-app-5u1acp.stackblitz.io

Ionic Info

Ionic:

Ionic CLI : 7.1.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/react 8.1.0

Capacitor:

Capacitor CLI : 6.0.0
@capacitor/android : 6.0.0
@capacitor/core : 6.0.0
@capacitor/ios : 6.0.0

Utility:

cordova-res : 0.15.4
native-run : 2.0.1

System:

NodeJS : v20.12.2 (/usr/local/bin/node)
npm : 10.5.0
OS : Linux 5.14

───────────────────────────────────────────────

 Ionic CLI update available: 7.1.1 → 7.2.0
     Run npm i -g @ionic/cli to update

───────────────────────────────────────────────

Additional Information

image

@thetaPC
Copy link
Contributor

thetaPC commented May 17, 2024

Thank you for the issue!

The repro URL isn't loading for me. Can you verify that the following snippet is the code that is causing you an issue?

import React from 'react';
import { IonInput } from '@ionic/react';
import type { InputInputEventDetail, IonInputCustomEvent } from '@ionic/react'

function Example() {
  return (
    <IonInput label="input" value="53703" onIonInput={(e: IonInputCustomEvent<InputInputEventDetail>) => console.log(e)}></IonInput>
  );
}
export default Example;

@thetaPC thetaPC added the needs: reply the issue needs a response from the user label May 17, 2024
@ionitron-bot ionitron-bot bot removed the triage label May 17, 2024
@thetaPC
Copy link
Contributor

thetaPC commented May 31, 2024

I can verify that the issue exists! We'll be reviewing your PR soon!

@ionitron-bot ionitron-bot bot added triage and removed needs: reply the issue needs a response from the user labels May 31, 2024
github-merge-queue bot pushed a commit that referenced this issue May 31, 2024
Issue number: resolves #29518 

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->
IonInput in React apps can't import the correct type for typescript.  
## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->
Since it is in the file exported, people using IonInput can import the
correct type.
-
-
-

## Does this introduce a breaking change?

- [ ] Yes
- [x ] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Liam DeBeasi told me it was a bug a couple days ago and pointed out to
where it needed to be added.
@thetaPC
Copy link
Contributor

thetaPC commented May 31, 2024

Thanks for the issue! This has been resolved via PR #29512 and will be available in an upcoming release of Ionic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants