diff --git a/packages/runtime-core/src/component.ts b/packages/runtime-core/src/component.ts index d343b7e5054..f50b11730c8 100644 --- a/packages/runtime-core/src/component.ts +++ b/packages/runtime-core/src/component.ts @@ -70,6 +70,18 @@ import { SchedulerJob } from './scheduler' export type Data = Record +/** + * Public utility type for extracting the instance type of a component. + * Works with all valid component definition types. This is intended to replace + * the usage of `InstanceType` which only works for + * constructor-based component definition types. + * + * Exmaple: + * ```ts + * const MyComp = { ... } + * declare const instance: ComponentInstance + * ``` + */ export type ComponentInstance = T extends { new (): ComponentPublicInstance } ? InstanceType : T extends FunctionalComponent