Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

svelte/events on does not allow specifying event type #12027

Closed
minht11 opened this issue Jun 13, 2024 · 0 comments · Fixed by #12053
Closed

svelte/events on does not allow specifying event type #12027

minht11 opened this issue Jun 13, 2024 · 0 comments · Fixed by #12053

Comments

@minht11
Copy link

minht11 commented Jun 13, 2024

Describe the bug

Using code below produces typescript error

Argument of type '(e: PointerEvent) => void' is not assignable to parameter of type 'EventListener'.
import { on } from 'svelte/events'

on(node, 'pointerdown', (e: PointerEvent) => {
})

It should prob be generic.

Reproduction

Svelte playground does not support types so.

Logs

No response

System Info

svelte 5.0.0-next.154

Severity

annoyance

@dummdidumm dummdidumm added this to the 5.0 milestone Jun 13, 2024
dummdidumm added a commit that referenced this issue Jun 17, 2024
- give autocompletion for types and more precise event types for html elements
- allow to pass other kinds of event target nodes, like window

closes #12027
fixes #12045
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants