Question · Vue.js course · Module 15: TypeScript & Nuxt

Calling a Typed Emit

Given const emit = defineEmits<{ alert: [level: string, msg: string] }>(), which call is correct?

Answer options

  • emit('alert', 'high', 'Uwaga!')
  • emit('alert', { level: 'high', msg: 'Uwaga!' })
  • emit.alert('high', 'Uwaga!')
  • emit({ type: 'alert', level: 'high' })

You can check the correct answer by solving this task in the CodeWorlds game.