diff --git a/packages/runtime-core/src/apiDefineComponent.ts b/packages/runtime-core/src/apiDefineComponent.ts index 47bcf9f2acb..d63bd8314e7 100644 --- a/packages/runtime-core/src/apiDefineComponent.ts +++ b/packages/runtime-core/src/apiDefineComponent.ts @@ -89,6 +89,30 @@ export type DefineComponent< > & PP +type DirectSetupComponent< + P extends Record, + E extends EmitsOptions = {}, + S extends SlotsType = SlotsType, + Props = P & EmitsToProps, + PP = PublicProps, +> = new ( + props: Props & PP, +) => CreateComponentPublicInstance< + Props, + {}, + {}, + {}, + {}, + ComponentOptionsMixin, + ComponentOptionsMixin, + E, + PP, + {}, + false, + {}, + S +> + // defineComponent is a utility that is primarily used for type inference // when declaring components. Type inference is provided in the component // options (provided as the argument). The returned value has artificial types @@ -111,7 +135,7 @@ export function defineComponent< emits?: E | EE[] slots?: S }, -): (props: Props & EmitsToProps) => any +): DirectSetupComponent export function defineComponent< Props extends Record, E extends EmitsOptions = {}, @@ -127,7 +151,7 @@ export function defineComponent< emits?: E | EE[] slots?: S }, -): (props: Props & EmitsToProps) => any +): DirectSetupComponent // overload 2: object format with no props // (uses user defined props interface)