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

Cannot use generic components inside defineComponent #2709

Closed
mtorromeo opened this issue Apr 25, 2023 · 0 comments
Closed

Cannot use generic components inside defineComponent #2709

mtorromeo opened this issue Apr 25, 2023 · 0 comments
Labels
bug Something isn't working good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first

Comments

@mtorromeo
Copy link

If I add a generic component inside the components section of another component, volar/vue-tsc will report the error "No overload matches this call".

MyList.vue

<script setup lang="ts" generic="T extends string | number">
defineProps<{ options: T[] }>();
</script>

<template>
  <ul>
    <li v-for="option of options">{{ option }}</li>
  </ul>
</template>

App.vue

<script lang="ts">
import { defineComponent } from 'vue';
import MyList from './components/MyList.vue';

export default defineComponent({
  components: {
    MyList, // <-- error: No overload matches this call
  },
});
</script>

This was working fine with vue-tsc 1.2 with experimentalRfc436.

Reproduction: run npm run build in a terminal on this stackblitz https://stackblitz.com/edit/vitejs-vite-wytdyb?file=src%2FApp.vue,src%2Fcomponents%2FMyList.vue&terminal=dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first
Projects
None yet
Development

No branches or pull requests

2 participants