Recently, I came across a post discussing whether TypeScript supports TouchEvent. The article mentioned that TypeScript 1.5.3 included declarations for HTML Touch events in lib.d.ts.
But now, with TypeScript version 1.7.6, I'm encountering an error in Visual Studio 2015 stating: Property 'changedTouches' does not exist on type 'Event.'
I tried downloading the latest jquery.TypeScript.DefinitelyTyped version="2.8.8" using NuGet but it didn't seem to work. Does anyone have any suggestions?
Update: After checking the jquery d.ts file both from NuGet and GitHub, I found them to be the same.
Code Snippet:
$('#previewEvent').on('mousedown touchstart', function(e) {
var original = e.originalEvent;
if (original.changedTouches && CheckMobile.isTouch_p) {
const touchobj = original.changedTouches[0];
swipedir = 'none';
distX = 0;
distY = 0;
startX = touchobj.pageX;
startY = touchobj.pageY;
startTime = new Date().getTime();
return !0;
} else if (!CheckMobile.isTouch_p) {
return !0;
}
return !0;
});
Update: I initially misunderstood what lib.d.ts referred to, thinking it was related to jQuery when it is actually one of the libraries installed with TypeScript.
Even after updating the library, I still face the same error. Although the lib.d.ts file seems to include touch event definitions, there seems to be compatibility issues between jQuery BaseJQueryEventObject interface and TypeScript TouchEvent interface.
Any thoughts on how to fix this issue correctly? It seems like resolving the interfaces might require a third d.ts file.
Thank you...