diff --git a/packages/runtime-core/src/apiDefineComponent.ts b/packages/runtime-core/src/apiDefineComponent.ts index 138f185fca2..3748fc81c63 100644 --- a/packages/runtime-core/src/apiDefineComponent.ts +++ b/packages/runtime-core/src/apiDefineComponent.ts @@ -209,11 +209,13 @@ export function defineComponent< ? TypeEmitsToOptions : RuntimeEmitsOptions, InferredProps = unknown extends TypeProps - ? string extends RuntimePropsKeys - ? ComponentObjectPropsOptions extends RuntimePropsOptions - ? {} - : ExtractPropTypes - : { [key in RuntimePropsKeys]?: any } + ? keyof TypeProps extends never + ? string extends RuntimePropsKeys + ? ComponentObjectPropsOptions extends RuntimePropsOptions + ? {} + : ExtractPropTypes + : { [key in RuntimePropsKeys]?: any } + : TypeProps : TypeProps, TypeRefs extends Record = {}, TypeEl extends Element = any, diff --git a/packages/runtime-core/src/componentProps.ts b/packages/runtime-core/src/componentProps.ts index c864ba15535..e07fb476788 100644 --- a/packages/runtime-core/src/componentProps.ts +++ b/packages/runtime-core/src/componentProps.ts @@ -125,7 +125,9 @@ type InferPropType = [T] extends [null] : InferPropType : [T] extends [Prop] ? unknown extends V - ? IfAny + ? keyof V extends never + ? IfAny + : V : V : T