Skip to content

Cannot use InstanceType<typeof Comp<any>>> on generic components #3206

Closed
@pikax

Description

@pikax

Since the push of adding generic components on Vue 3.3.0, we don't seem able to get the InstanceType aka public instance anymore.

<script setup lang="ts" generic="T"> const props = withDefaults(defineProps<{ value?: T | null;	list: T[]; }>(), { value: null, }); </script> <template> <select> // code </select> </template>
<script lang="ts"> import MyComp from './MyComp.vue' // This has error const el = ref<null | InstanceType<typeof MyComp<any>>>( null ) </script> <template> <my-comp ref="el" list="[]"/> </template>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions