interface TouchWindow extends Window { TouchEvent : unknown ; DocumentTouch : Function ; } declare let window ; export function isTouchDevice ( ) { if ( "ontouchstart" in window || ( window . DocumentTouch && document instanceof window . DocumentTouch ) ) { return true ; } const query = "(touch-enabled),(-webkit-touch-enabled),(-moz-touch-enabled),(-o-touch-enabled),(-ms-touch-enabled)" ; return window . matchMedia ( query ) . matches ; }