Typescript does not support proper Touch constructor
See original GitHub issueTypescript 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:
- Created 6 years ago
- Reactions:4
- Comments:11 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Has been fixed by https://github.com/Microsoft/TSJS-lib-generator/pull/415
@olegdunkan I’m sorry, I don’t understand you.
new(): Touch
is not valid as you cannot donew Touch()
to create a new one you need and initialisation object with propertiestarget
andidentifier
.If you meant that that the constructor includes params, I cannot see them.
https://developer.mozilla.org/en-US/docs/Web/API/Touch/Touch