fix(types): declared prop keys should always exist in props argument (#3726)
This commit is contained in:
@@ -65,7 +65,7 @@ import {
|
||||
import { warn } from './warning'
|
||||
import { VNodeChild } from './vnode'
|
||||
import { callWithAsyncErrorHandling } from './errorHandling'
|
||||
import { UnionToIntersection } from './helpers/typeUtils'
|
||||
import { LooseRequired, UnionToIntersection } from './helpers/typeUtils'
|
||||
import { deepMergeData } from './compat/data'
|
||||
import { DeprecationTypes } from './compat/compatConfig'
|
||||
import {
|
||||
@@ -130,9 +130,13 @@ export interface ComponentOptionsBase<
|
||||
ComponentCustomOptions {
|
||||
setup?: (
|
||||
this: void,
|
||||
props: Props &
|
||||
UnionToIntersection<ExtractOptionProp<Mixin>> &
|
||||
UnionToIntersection<ExtractOptionProp<Extends>>,
|
||||
props: Readonly<
|
||||
LooseRequired<
|
||||
Props &
|
||||
UnionToIntersection<ExtractOptionProp<Mixin>> &
|
||||
UnionToIntersection<ExtractOptionProp<Extends>>
|
||||
>
|
||||
>,
|
||||
ctx: SetupContext<E>
|
||||
) => Promise<RawBindings> | RawBindings | RenderFunction | void
|
||||
name?: string
|
||||
|
||||
@@ -3,3 +3,6 @@ export type UnionToIntersection<U> = (U extends any
|
||||
: never) extends ((k: infer I) => void)
|
||||
? I
|
||||
: never
|
||||
|
||||
// make keys required but keep undefined values
|
||||
export type LooseRequired<T> = { [P in string & keyof T]: T[P] }
|
||||
|
||||
Reference in New Issue
Block a user