Adding typings #82
Unanswered
TomSwiedler
asked this question in
Q&A
Replies: 2 comments 3 replies
-
|
Does typescript support method overloading ? Can we implement At some point I was thinking of adding JSDoc annotations to Tonic to make it more typescript friendly. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
If someone wants the base class' behavior of click (e) {
if (!e) super.click()
/* ... */
}in that case, Another thing to consider is sometimes methods are async... async click (e) {
if (!e) return super.click()
/* ... */
}So maybe something like |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I was working to create a tonic.d.ts file when I ran into the following issue:
HTMLElement defines the click method as: click(): void. This is use to simulate a click on the element in code.
Tonic uses the the click signature: click(e:Event): void;
This can be handled in tonic.d.ts by adding: click(e?:Event):void
However it requires the implementation of the click handlers to use click(e?:Event): void for their signatures.
Would it make sense to use onClick(e?:Event) or similar in the Tonic implementation rather than overloading the click method of the HTMLElement?
Beta Was this translation helpful? Give feedback.
All reactions