Connecting js code to typescript

Hi,

I’m making an app that uses a js map library (leaflet) , this works fine. The problem is that leaflet adds html on the popups to style it. If i want to add a onclick event on the popup that triger typescript code , is it possible? For mor information the html is an string defined on the typescript class

Now I did a crapy workaround adding a hiddent element on the page html and simulating a click on it, but I want to know if there is a better way to do this.

Thank you and best reggards