Skip to content

defineEmits not respected in JSDoc-based strictTemplates project #5379

Open
@phil294

Description

@phil294

Vue - Official extension or vue-tsc version

v3.0.0-alpha.6, downloaded directly as vsix

VSCode version

1.89.1

Vue version

3.5.13

TypeScript version

5.4.5 I guess if I create a .ts file?

System Info

System:
    OS: Linux 6.6 Manjaro Linux
    CPU: (4) x64 Intel(R) Core(TM) i3-7100U CPU @ 2.40GHz
    Memory: 10.73 GB / 19.42 GB
    Container: Yes
    Shell: 5.2.37 - /bin/bash
  Binaries:
    Node: 22.5.1 - ~/.nvm/versions/node/v22.5.1/bin/node
    Yarn: 1.22.22 - /usr/bin/yarn
    npm: 10.8.2 - ~/.nvm/versions/node/v22.5.1/bin/npm
    pnpm: 10.9.0 - /usr/bin/pnpm
  Browsers:
    Chromium: 136.0.7103.59

package.json dependencies

{
  "dependencies": {
    "vue": "^3.5.13"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^5.2.1",
    "vite": "^6.0.3"
  }
}

Steps to reproduce

Repro link https://github.com/phil294/demo-vue-lang-bug-emits/

Define a component NON-typescript, but with jsconfig script mode on, including strictTemplates.

<script setup>
defineEmits(['emit1'])
</script>

and require said component in another component. You'll get an error saying onEmit1 isn't defined.

<template>
  <!-- Object literal may only specify known properties, and 'onEmit1' does not exist in type 'NonNullable<Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never> & { ...; }>'.ts-plugin(2353) -->
  <my-component @emit="Boolean" />
</template

Or in the demo repro repo, simply open App.vue and you'll see the error there.

What is expected?

defineEmits should define emits in strict non-TS projects

What is actually happening?

only props can be defined, emits are ignored, leading to errors

Link to minimal reproduction

https://github.com/phil294/demo-vue-lang-bug-emits

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    good reproduction ✨This issue provides a good reproduction, we will be able to investigate it first

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions