‘event’ is deprecated.ts(6385)

So I’m currently having issues getting around this ‘event’, from what I’ve currently read i need to pass it through an event handler function as when used in external JS ‘event’ is for windows.event.

var tablinks = document.getElementsByClassName("tab-links");
var tabcontents = document.getElementsByClassName("tab-contents");
function opentab(tabname) {
    for (tablink of tablinks) {
        tablink.classList.remove("active-link")
    }
    for (tabcontent of tabcontents) {
        tabcontent.classList.remove("active-tab");
    }
    event.currentTarget.classList.add("active-link");
    document.getElementById(tabname).classList.add("active-tab");
}

Something along the lines of..

tablink.addEventListener('click', function(event) {
    opentab(event, 'active-tab');

Would someone care to break this down for me?
Appreciate it.

Attempted to replace the code using event handler.