primevue icon indicating copy to clipboard operation
primevue copied to clipboard

Toast: Incorrect Type Definition for Close Event

Open dsherley9 opened this issue 1 year ago • 0 comments

Describe the bug

The type definition for the close event shows that the argument for the close event is ToastMessageOptions. However, during testing, I discovered that the code was emitting an object that wraps the message. In other words, during runtime, I was receiving more like the following.

type CloseEvent = {
    message: ToastMessageOptions
}

I suggested modifying the type definition, however I believe the toast close event could be modified to not wrap it. This would be a breaking change for existing users though.

Type Definition

https://github.com/primefaces/primevue/blob/master/components/lib/toast/Toast.d.ts#L329-L340

Wrapping of Message

https://github.com/primefaces/primevue/blob/344ec64cd461aad1493073dd3ff10bc8a7338654/components/lib/toast/Toast.vue#L74-L86

Reproducer

https://stackblitz.com/edit/primevue-nuxt-issue-template-fapfro?file=app.vue

PrimeVue version

3.50.0

Vue version

3.x

Language

TypeScript

Build / Runtime

Vue CLI App

Browser(s)

No response

Steps to reproduce the behavior

  1. Add <Toast /> component.
  2. Add a @close event handler.
  3. Observe the argument during runtime.

Expected behavior

I expected the argument to be of type ToastMessageOptions.

dsherley9 avatar Apr 19 '24 15:04 dsherley9