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 Definition For Custom Events?

See original GitHub issue

I know that I can listen to native events using onXXX. However I can’t find out how to listen to custom events (emit()ed). Is there any way to do this?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

9reactions
XiNiHacommented, Jan 17, 2021

I know that - actually have mentioned in the previous comment. I was just thinking about automatically generating type definitions from items in the emits property.

0reactions
Zcatingcommented, Jan 17, 2021

add onXXX on props.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you create custom Event in Typescript? - Stack Overflow
Here is how it is defined in lib.dom.d.ts (which is in the lib directory of your npm typescript installation): interface CustomEvent<T = any>...
Read more >
CustomEvent | typescript - v3.7.7
Returns any custom data event was created with. Typically used for synthetic events. eventPhase. eventPhase: number. Inherited from Event.eventPhase.
Read more >
Using strongly typed events in TypeScript - 43081j
It is common that we might want to emit custom events from our components. For example: class MyElement extends HTMLElement ...
Read more >
CustomEvent() - Web APIs | MDN
A string providing the name of the event. Event names are case-sensitive. options Optional. An object that, in addition of the properties defined...
Read more >
TypeScript doesn't allow event : CustomEvent in ... - GitHub
In the lib.dom.d.ts file I have the following definition for ... addEventListener(); interface WindowEventMap { "custom-event": ...
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