Skip to content

Error ts(2322) in v-on 'void' is not assignable to type 'undefined' #479

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

Closed
drocha87 opened this issue Sep 10, 2021 · 3 comments
Closed
Labels
duplicate This issue or pull request already exists

Comments

@drocha87
Copy link

Hey guys, I don't know if this problem is related to volar or vue3, but I realized that after my volar upgraded to version 0.27.17 I started to receive error messages when using my components.

Screenshot from 2021-09-10 16-16-11

Maybe the way I'm typing the emit event was wrong? I'm typing it inside the component like this like this.

<script lang="ts">
import { defineComponent, ref } from 'vue'
import { Question } from '../types'

...

interface Answer {
 ...
}

export default defineComponent({
  components: {
    ResourceQuestion,
  },

  props: {
    ...
  },

  setup(props) {
    ...
    const emit = defineEmits<{
      (event: 'answer', data: Answer): void
    }>()

    ...
    return {
    ...
    }
  },
})
</script>

}>()

volar version: 0.27.17
vscode version: 1.60.0
typescript version: 4.4.2

@johnsoncodehk
Copy link
Member

This is known vue type issue, please try update your vue version to latest.

@johnsoncodehk
Copy link
Member

Duplicate of #460

@johnsoncodehk johnsoncodehk marked this as a duplicate of #460 Sep 10, 2021
@johnsoncodehk johnsoncodehk added duplicate This issue or pull request already exists and removed upstream labels Sep 10, 2021
@drocha87
Copy link
Author

Thank you, updating the deps indeed fixed the problem!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants