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.

Type of `delegate(Element, string, EventType, Handler)` doesn't seem to work

See original GitHub issue

These work in TypeScript:

delegate(".base", ".clickable", "click", handler);
delegate(select.all(".base"), ".clickable", "click", handler);
This doesn't

But the Single base element specified overload doesn’t:

delegate(select(".base"), ".clickable", "click", handler);
      TS2345: Argument of type 'HTMLElement | null' is not assignable to parameter of type 'string | ArrayLike<Element>'.
  Type 'null' is not assignable to type 'string | ArrayLike<Element>'.

cc @nickytonline

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
fregantecommented, May 9, 2019

Indeed it was! Sorry about the noise 😅

1reaction
fregantecommented, May 9, 2019

I think… that’s because select returns HTMLElement | null I’ll try again with select()!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Event handler not working on dynamic content - Stack Overflow
So when I click on tag B, action B is performed. However, the .on method does not seems to be working on the...
Read more >
Event listeners not working? 3 key areas to troubleshoot
Are your event listeners not working as you'd expect? Here are 3 key areas to troubleshoot to help you get everything triggering as...
Read more >
Event delegation - The Modern JavaScript Tutorial
The document-level handler makes it work for any element of the page. We can combine multiple behaviors on a single element as well....
Read more >
EventHandler Delegate (System) - Microsoft Learn
The EventHandler delegate is a predefined delegate that specifically represents an event handler method for an event that does not generate data. If...
Read more >
wilsonpage/dom-delegate: Create and manage a ... - GitHub
Delegate is a simple, easy-to-use component for binding to events on all target elements matching the given selector, irrespective of whether they exist...
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