[Vuejs]-In Vue with TypeScript, SubmitEvent handler is not assignable

1👍

SubmitEvent interface is based on Event interface. Thus, you can cast Event to SubmitEvent;

function handleSubmit(e: Event) {
    const event = e as SubmitEvent;
    console.log(`Submitted: ${event.defaultPrevented}`);
}

Leave a comment