diff --git a/packages/runtime-core/src/apiSetupHelpers.ts b/packages/runtime-core/src/apiSetupHelpers.ts index 54712c6807a..983960752cb 100644 --- a/packages/runtime-core/src/apiSetupHelpers.ts +++ b/packages/runtime-core/src/apiSetupHelpers.ts @@ -81,10 +81,7 @@ export function defineProps< PP extends ComponentObjectPropsOptions = ComponentObjectPropsOptions, >(props: PP): Prettify>> // overload 3: typed-based declaration -export function defineProps(): DefineProps< - LooseRequired, - BooleanKey -> +export function defineProps(): DefineProps> // implementation export function defineProps() { if (__DEV__) { @@ -93,7 +90,10 @@ export function defineProps() { return null as any } -export type DefineProps = Readonly & { +export type DefineProps< + T, + BKeys extends keyof T = BooleanKey, +> = Readonly & { readonly [K in BKeys]-?: boolean } diff --git a/packages/runtime-core/src/componentPublicInstance.ts b/packages/runtime-core/src/componentPublicInstance.ts index e9e7770ebd9..d0573113353 100644 --- a/packages/runtime-core/src/componentPublicInstance.ts +++ b/packages/runtime-core/src/componentPublicInstance.ts @@ -54,6 +54,7 @@ import { markAttrsAccessed } from './componentRenderUtils' import { currentRenderingInstance } from './componentRenderContext' import { warn } from './warning' import { installCompatInstanceProperties } from './compat/instance' +import type { DefineProps } from './apiSetupHelpers' import type { Directive } from './directives' /** @@ -333,7 +334,8 @@ export type ComponentPublicInstance< IfAny< P, P, - Readonly & Omit | keyof Defaults> + Readonly & + Omit, keyof ShallowUnwrapRef | keyof Defaults> > & ShallowUnwrapRef & UnwrapNestedRefs &