question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript does not support proper Touch constructor

See original GitHub issue

Typescript does not support the valid Touch constructor

TypeScript Version: 2.3.1

Code

const a = new Touch({
  identifier: 2,
  target: document.body
})

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.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:4
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
saschanazcommented, Nov 14, 2018
1reaction
dblVscommented, May 16, 2017

@olegdunkan I’m sorry, I don’t understand you. new(): Touch is not valid as you cannot do new Touch() to create a new one you need and initialisation object with properties target and identifier.

If you meant that that the constructor includes params, I cannot see them.

https://developer.mozilla.org/en-US/docs/Web/API/Touch/Touch

Read more comments on GitHub >

github_iconTop Results From Across the Web

When to Use a Private Constructor | TypeScript OOP
In this blog post, I explain how using a private constructor helps to force a single way to create an object, and why...
Read more >
Typescript "this" inside a class method - jquery - Stack Overflow
The problem arises when you pass a function as a callback. By the time the callback has executed the value of ...
Read more >
Documentation - Classes - TypeScript
Constructors can't have return type annotations - the class instance type is always what's returned. Super Calls. Just as in JavaScript, if you...
Read more >
The Proper Way to Write Async Constructors in JavaScript
Tagged with javascript, typescript, tips, async. ... As far as I know, TypeScript does not allow the constructor to be directly ...
Read more >
typescript create type from object - Philadelphia Mixing Solutions
Well, you can't iterate over an interface with pure typescript; you would need ... JavaScript does a good job parsing plain Objects into...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found