Skip to content

How do I get the type of emit? #9861

Discussion options

You must be logged in to vote

You can try using the following method:

const emit = defineEmits(['foo', 'bar'])

function emitEvent(eventName:Parameters<typeof emit>[0]) {
  // do other stuff here

  emit(eventName)
}

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
3 replies
@frederikheld
Comment options

@Alfred-Skyblue
Comment options

@jacekkarczmarczyk
Comment options

Answer selected by frederikheld
Comment options

You must be logged in to vote
2 replies
@sadeghbarati
Comment options

@Y80
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
6 participants