ionic-team/ionic-framework

feat: Improved types for react useIonModal

Open

#28.680 aperta il 11 dic 2023

Vedi su GitHub
 (8 commenti) (0 reazioni) (0 assegnatari)TypeScript (13.381 fork)batch import
help wantedpackage: reacttype: feature request

Metriche repository

Star
 (52.503 star)
Metriche merge PR
 (Merge medio 4g 10h) (56 PR mergiate in 30 g)

Descrizione

Prerequisites

Describe the Feature Request

useIonModal should type props parameter.

Describe the Use Case

useIonModal currently allows any for component props. This is dangerous and has caused many crashes and unintended behaviors in my experience.

Currently:

export declare function useIonModal(component: ReactComponentOrElement, componentProps?: any): UseIonModalResult;

Describe Preferred Solution

export declare function useIonModal<P>(component: React.ComponentClass<P> | React.FC<P>, componentProps?: P): UseIonModalResult;
export declare function useIonModal(component: React.ReactElement, componentProps?: any): UseIonModalResult;

Describe Alternatives

Leaving as-is

Related Code

No response

Additional Information

If you would accept this change, I would happily make a PR

Guida contributor