ionic-team/ionic-framework

feat: Improved types for react useIonModal

已关闭

#28,680 创建于 2023年12月11日

 (8 条评论) (0 个反应) (0 位负责人)TypeScript (13,381 个派生)batch import
help wantedpackage: reacttype: feature request

仓库指标

星标
 (52,503 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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

贡献者指南