ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

feat(react): type check component props for useIonModal, useIonPopover

Open aeharding opened this issue 1 year ago • 0 comments

Issue number: resolves #28680


What is the current behavior?

useIonModal and useIonPopover do not type check component parameters. This can cause bugs in applications that heavily use these hooks.

What is the new behavior?

  • useIonModal and useIonPopover have new types
  • If a component does not have props, second parameter can be omitted (extends undefined)
  • Passing a JSX Element keeps old functionality (any for props)

Does this introduce a breaking change?

  • [ ] Yes
  • [X] No

This may be considered a breaking change, because typescript will now complain if component props do not match up. The majority of my useIonModal usages required tweaks.

Other information

aeharding avatar Feb 15 '24 02:02 aeharding