Skip to content

How to import emits interface #9541

@adamPrestor

Description

@adamPrestor

Vue version

3.3.7

Link to minimal reproduction

https://play.vuejs.org/#eNp9k02P0zAQhv/K4EtasUpY7a2kFWxVCTgAAiQuvqTJtPWuY0f+KEVR/jtju21KtdtLlJl5Z+bxeNyzj12X7z2yGSttbUTnwKLz3YIr0XbaOOjB4AYG2BjdQkbS7Bxa6rY7+vMiGKFS9p4rrmqtrIPWbmEe8ifZJ5RSw29tZPMmm3JVFqkdNSLDYdvJyiFZAOXuftH3MXkYyoKs6I3dCvovi7Oc3TFnqddGbPMnqxUdow9izmpSC4nmW+cEsXA2gxgJsYpQ/nyJPmc83p389Q7r5xf8T/YQfJx9N2jR7JGzc8xVZosuhVc/v+KB/s/BVjdekvpG8AdaLX1gTLJHrxrCvtBF2s9x4kJtf9nVwaGyp0MF0KAcop4zuoEwqNeOPuI+5A8xj6uBphjGpW21lpg7S1PEQ7xhoRyaTVUjPFYWV61wNtaaYGCtd5XahmGAaGagfLtGM53BXosmVT3txPV2gaTEOdEQ3K1No1U6x0aAkyIvRuq0dSNuUtLAUTX2Cj7SZ14tI372Mv1phTGmzaHBjVCpSBm/i8n0YtNr7ZU77vq7/wJS1M+rPcboZArzRWKICfm+kh7h7Rzugy/2mmRprMR1oQklienWq1l757QC97dDGm2yOIMPkYA8IwkNfRlK0170R/Lw0FLK1QMb/gFe22bk

Steps to reproduce

Similar to issue #4294

component.ts:
export interface Base { (e: "change", id: number): void }

Comp.vue
import { Base } from ./component.ts

interface Emits extends Base { (e: "unChange", id: number): void }
const emit = defineEmits()

emit(change, 1)

What is expected?

Component registers change as possible event, no errors/warnings raised.

What is actually happening?

[Vue warn]: Component emitted event "change" but it is neither declared in the emits option nor as an "onChange" prop.

System Info

No response

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions