Skip to content

Event handler with modifier and no callback doesn't typecheck #180

Closed
@henribru

Description

@henribru

If you do e.g. @keydown.space.prevent (notice the lack of ="someCallback"), you get this error Type 'undefined' is not assignable to type '((...payload: unknown[]) => void) | ((...args: any) => void)'. Having an event handler that only has a modifier and no callback is legal and useful, so it shouldn't give an error.

Activity

johnsoncodehk

johnsoncodehk commented on May 13, 2021

@johnsoncodehk
Member

@keydown.space.prevent do not report error for me, please provide a repro case.

螢幕截圖 2021-05-14 上午12 41 15

henribru

henribru commented on May 13, 2021

@henribru
Author

Seems like it happens on Vue components but not native HTML elements: https://github.com/henribru/volar-event-handler-repo

added
bugSomething isn't working
and removed on May 13, 2021
johnsoncodehk

johnsoncodehk commented on May 18, 2021

@johnsoncodehk
Member

Fixed in 0.25.5. Thanks for your report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Event handler with modifier and no callback doesn't typecheck · Issue #180 · vuejs/language-tools