I want fix all errors
I have this error 1
My code
function onMouseTouchDown(e: React.SyntheticEvent<HTMLDivElement>) {
e.preventDefault()
setDown(true)
if (e.type === "touchmove" && e.changedTouches) {
setX(e.changedTouches[0].pageX - e.currentTarget.offsetLeft)
} else {
setX(e.pageX - e.currentTarget.offsetLeft)
}
setScrollLeft(e.currentTarget.scrollLeft)
}
codesandbox – https://codesandbox.io/p/sandbox/slider-jc-consoleerror-type-error-tktvxn?file=%2Fsrc%2Fhooks%2FuseSlider.ts%3A49%2C6
Help me please fix this error
2
Answers
To search in which property exist some type go to developer.mozilla.org and search
And include it to your interface
If you need you can extend some type to your interface e.g TouchEvent
You can modify your code like this: