ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
50.66k stars 13.52k forks source link

bug: IonIcons JSX not included in exported JSX namespace #18883

Closed SimoneIrato closed 2 years ago

SimoneIrato commented 4 years ago

Bug Report

Ionic version: [x] 4.x

Current behavior: When importing Ionic inside a React project (not Ionic React), IonIcons are working but JSX is not included in exported namespace

Expected behavior: When using <ion-icon> element proper JSX binding should be provided.

Steps to reproduce:

This is the snippets that fixes the behavior. I have pull request ready to be submitted

export namespace JSX {
    export interface IntrinsicElements extends IonicJSX.IntrinsicElements{}
}

Ionic info: Not using CLI

elylucas commented 4 years ago

Hi @SimoneIrato,

Could you help me understand your use case better? Is there a reason you aren't directly using ionic/react?

Thanks

SimoneIrato commented 4 years ago

Hi @elylucas,

We're currently building a web component library with Stenciljs that embeds also all Ionic components, and will be consumed in a monorepo by a set of webapps without specific framework requirements. At the moment we're using React for one of those apps but we don't want to get tied to a specific "framework". This way we can export all components and import their jsx type in case we need them.

If there's any info missing just ask 😄 Thanks

edolix commented 4 years ago

I have the same issue exporting a Stencil component with reactOutputTarget. My component uses Ionicons with:

import { backspace } from 'ionicons/icons'

<ion-icon slot="icon-only" icon={backspace}></ion-icon>

And the resulting React proxies have the error Namespace 'LocalJSX' has no exported member 'IonIcon'. here:

/* auto-generated react proxies */
// ...
export const IonIcon = /*@__PURE__*/createReactComponent<JSX.IonIcon, HTMLIonIconElement>('ion-icon');
// ...

@stencil/core : v1.8.4 @stencil/react-output-target : v0.0.3

@SimoneIrato did you found a solution?

liamdebeasi commented 2 years ago

Thanks for the issue! This was resolved in https://github.com/ionic-team/ionic-framework/pull/21788 and is available now in the latest version of Ionic.

ionitron-bot[bot] commented 2 years ago

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.