Merge 18255786d3
into 5f8314cb7f
This commit is contained in:
commit
8efd6ad119
|
@ -81,10 +81,7 @@ export function defineProps<
|
|||
PP extends ComponentObjectPropsOptions = ComponentObjectPropsOptions,
|
||||
>(props: PP): Prettify<Readonly<ExtractPropTypes<PP>>>
|
||||
// overload 3: typed-based declaration
|
||||
export function defineProps<TypeProps>(): DefineProps<
|
||||
LooseRequired<TypeProps>,
|
||||
BooleanKey<TypeProps>
|
||||
>
|
||||
export function defineProps<TypeProps>(): DefineProps<LooseRequired<TypeProps>>
|
||||
// implementation
|
||||
export function defineProps() {
|
||||
if (__DEV__) {
|
||||
|
@ -93,7 +90,10 @@ export function defineProps() {
|
|||
return null as any
|
||||
}
|
||||
|
||||
export type DefineProps<T, BKeys extends keyof T> = Readonly<T> & {
|
||||
export type DefineProps<
|
||||
T,
|
||||
BKeys extends keyof T = BooleanKey<T>,
|
||||
> = Readonly<T> & {
|
||||
readonly [K in BKeys]-?: boolean
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Defaults> & Omit<P, keyof ShallowUnwrapRef<B> | keyof Defaults>
|
||||
Readonly<Defaults> &
|
||||
Omit<DefineProps<P>, keyof ShallowUnwrapRef<B> | keyof Defaults>
|
||||
> &
|
||||
ShallowUnwrapRef<B> &
|
||||
UnwrapNestedRefs<D> &
|
||||
|
|
Loading…
Reference in New Issue