title: How to use EventTarget in Typescript
body: <p>Hey I am new to Typescript and I am having some trouble implementing Event Target.</p>
  
  <p>What is the typescript equivalent for event.target.matches that is used in Javascript?</p>
  
  <p>Example code:</p>
  
  <pre><code>function myFunction() {
      document.getElementById("myDropdown").classList.toggle("show");
  }
  
  // Close the dropdown menu if the user clicks outside of it
  window.onclick = function(event) {
    if (!event.target.matches('.dropbtn')) {
  
      var dropdowns = document.getElementsByClassName("dropdown-content");
      var i;
      for (i = 0; i &lt; dropdowns.length; i++) {
        var openDropdown = dropdowns[i];
        if (openDropdown.classList.contains('show')) {
          openDropdown.classList.remove('show');
        }
      }
    }
  }
  </code></pre>