How do I dismiss a modal w/ correct types in TypeScript & React?

I tried to use the example code provided here ion-modal: Ionic Mobile App Custom Modal API Component but HTMLIonModalElement is not defined.

If I omit HTMLIonModalElement and just write const modal = useRef(null); then I get no dismiss method on modal.current.

Please advice how I can call modal.current.dismiss with the correct types. :pray:

This was reported as a GitHub issue Not able to import HTMLIonModalElement - ionic v4 路 Issue #17809 路 ionic-team/ionic-framework 路 GitHub, but a contributor there said the question should be asked here.