Merge 18255786d3
into 5f8314cb7f
This commit is contained in:
commit
8efd6ad119
|
@ -81,10 +81,7 @@ export function defineProps<
|
||||||
PP extends ComponentObjectPropsOptions = ComponentObjectPropsOptions,
|
PP extends ComponentObjectPropsOptions = ComponentObjectPropsOptions,
|
||||||
>(props: PP): Prettify<Readonly<ExtractPropTypes<PP>>>
|
>(props: PP): Prettify<Readonly<ExtractPropTypes<PP>>>
|
||||||
// overload 3: typed-based declaration
|
// overload 3: typed-based declaration
|
||||||
export function defineProps<TypeProps>(): DefineProps<
|
export function defineProps<TypeProps>(): DefineProps<LooseRequired<TypeProps>>
|
||||||
LooseRequired<TypeProps>,
|
|
||||||
BooleanKey<TypeProps>
|
|
||||||
>
|
|
||||||
// implementation
|
// implementation
|
||||||
export function defineProps() {
|
export function defineProps() {
|
||||||
if (__DEV__) {
|
if (__DEV__) {
|
||||||
|
@ -93,7 +90,10 @@ export function defineProps() {
|
||||||
return null as any
|
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
|
readonly [K in BKeys]-?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ import { markAttrsAccessed } from './componentRenderUtils'
|
||||||
import { currentRenderingInstance } from './componentRenderContext'
|
import { currentRenderingInstance } from './componentRenderContext'
|
||||||
import { warn } from './warning'
|
import { warn } from './warning'
|
||||||
import { installCompatInstanceProperties } from './compat/instance'
|
import { installCompatInstanceProperties } from './compat/instance'
|
||||||
|
import type { DefineProps } from './apiSetupHelpers'
|
||||||
import type { Directive } from './directives'
|
import type { Directive } from './directives'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -333,7 +334,8 @@ export type ComponentPublicInstance<
|
||||||
IfAny<
|
IfAny<
|
||||||
P,
|
P,
|
||||||
P,
|
P,
|
||||||
Readonly<Defaults> & Omit<P, keyof ShallowUnwrapRef<B> | keyof Defaults>
|
Readonly<Defaults> &
|
||||||
|
Omit<DefineProps<P>, keyof ShallowUnwrapRef<B> | keyof Defaults>
|
||||||
> &
|
> &
|
||||||
ShallowUnwrapRef<B> &
|
ShallowUnwrapRef<B> &
|
||||||
UnwrapNestedRefs<D> &
|
UnwrapNestedRefs<D> &
|
||||||
|
|
Loading…
Reference in New Issue