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: Invalid emits typing #5737

Open
Magiczne opened this issue May 14, 2024 · 0 comments
Open

Toast: Invalid emits typing #5737

Magiczne opened this issue May 14, 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

@Magiczne
Copy link
Contributor

Describe the bug

Toast.d.ts defines typing for emits like so:

export interface ToastEmits {
    /**
     * Callback to invoke when the toast is closed.
     * @param {ToastMessageOptions} message - Toast message.
     */
    close(message: ToastMessageOptions): void;
    /**
     * Callback to invoke when the toast's timeout is over.
     * @param {ToastMessageOptions} message - Toast message.
     */
    'life-end'(message: ToastMessageOptions): void;
}

while the code for emitting events from toast looks like so:

this.$emit(params.type, { message: params.message });

therefore, the typings are not correct and should look e.g. like:

export interface ToastEmits {
    /**
     * Callback to invoke when the toast is closed.
     * @param {ToastMessageOptions} message - Toast message.
     */
    close(payload: { message: ToastMessageOptions }): void;
    /**
     * Callback to invoke when the toast's timeout is over.
     * @param {ToastMessageOptions} message - Toast message.
     */
    'life-end'(payload: { message: ToastMessageOptions }): void;
}

Reproducer

inside description

PrimeVue version

3.52.0, 4.0.0-beta2

Vue version

3.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

any

Steps to reproduce the behavior

No response

Expected behavior

No response

@Magiczne Magiczne added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label May 14, 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