-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Typescript does not support proper Touch constructor #15874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It should be: declare var Touch: {
prototype: Touch;
new(touchInit: {
target: HTMLElement,
identifier: number,
clientX?: number,
clientY?: number,
screenY?: number,
screenX?: number,
pageY?: number,
pageX?: number,
radiusX?: number,
radiusY?: number,
rotationAngle?: number,
force?: number
}): Touch;
} |
Check it https://github.com/Microsoft/TypeScript/blob/master/lib/lib.dom.d.ts#L11773 declare var Touch: {
prototype: Touch;
new(): Touch;
} There is now parameters in the constructor function |
@olegdunkan I'm sorry, I don't understand you. If you meant that that the constructor includes params, I cannot see them. https://developer.mozilla.org/en-US/docs/Web/API/Touch/Touch |
@dblVs you wrote declare var Touch: {
prototype: Touch;
new(touchInit: {
target: HTMLElement,
identifier: number,
clientX?: number,
clientY?: number,
screenY?: number,
screenX?: number,
pageY?: number,
pageX?: number,
radiusX?: number,
radiusY?: number,
rotationAngle?: number,
force?: number
}): Touch;
} It has got me confused because it doesn't match what I see in current lib.dom.d.ts. |
@olegdunkan ok, I edited to be more clear |
PRs welcomed. You can find more information about contributing lib.d.ts fixes at https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md#contributing-libdts-fixes. |
@dblVs 👍 , |
i want to creat a touchEvent , but the constructor need a parametertouch. let touch = new Touch(); but i need pageX and pageY , |
@VarLong I guess I'll add it soon. I didn't do anything on it, but I will these days when i get time. |
Has been fixed by microsoft/TypeScript-DOM-lib-generator#415 |
I see that this has been fixed in #24850, but my project is stuck on a 2.x version of TypeScript. How can I use Edit: using |
Just looking at old issues; this has been fixed in lib for a good while. |
Typescript does not support the valid Touch constructor
TypeScript Version: 2.3.1
Code
Expected behavior:
It should not error because this is the valid constructor for Touch.
Actual behavior:
Errors since the constructor for Touch does not accept any parameters.
The text was updated successfully, but these errors were encountered: