Skip to content
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

Toast: Incorrect Type Definition for Close Event #5624

Open
dsherley9 opened this issue Apr 19, 2024 · 0 comments
Open

Toast: Incorrect Type Definition for Close Event #5624

dsherley9 opened this issue Apr 19, 2024 · 0 comments
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@dsherley9
Copy link

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

remove(params) {
let index = -1;
for (let i = 0; i < this.messages.length; i++) {
if (this.messages[i] === params.message) {
index = i;
break;
}
}
this.messages.splice(index, 1);
this.$emit(params.type, { message: params.message });
},

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 dsherley9 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

1 participant