Why can't I use TouchEvent in Safari

Discussão em 'Angular' iniciado por Jørgen Rasmussen, Julho 8, 2025.

  1. I have a project with Angular 8 where I want to handle touch events. Example handler:

    @HostListener('touchend', ['$event']) onTouchend(event: TouchEvent) {
    event.preventDefault();
    }


    I am running on MacOS 10.15 and this works fine i Chrome, but in Safari I get this error message and my app doesn't run: "ReferenceError: Can't find variable: TouchEvent" and in Firefox "ReferenceError: TouchEvent is not defined". If I change the event type to any it runs in Safari and Firefox. Why can't I use the TouchEvent type in Safari?

    Continue reading...

Compartilhe esta Página