Open
Description
Clear and concise description of the problem
The method exposed by the component, refer to the component in the template, you need to manually import the component in the script, add a type.
const myFormRef = ref<InstanceType<typeof MyForm>>()
<template>
<MyForm ref="myFormRef"/>
</template>
Suggested solution
Add a switch to option, automatically declare the instance type of a component in components.d.ts
// components.d.ts
export interface GlobalComponents {
MyForm: typeof import('./components/MyForm.vue')['default']
MyFormInstance: InstanceType<GlobalComponents['MyForm']>
}
Maybe there's a more elegant way.
Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.