mirror of
https://github.com/vuejs/core.git
synced 2024-11-22 04:51:10 +00:00
fix(types): correct type inference of all-optional props (#11644)
fix #11733 fix vuejs/language-tools#4704
This commit is contained in:
parent
235ea4772e
commit
9eca65ee98
@ -209,11 +209,13 @@ export function defineComponent<
|
||||
? TypeEmitsToOptions<TypeEmits>
|
||||
: RuntimeEmitsOptions,
|
||||
InferredProps = unknown extends TypeProps
|
||||
? string extends RuntimePropsKeys
|
||||
? ComponentObjectPropsOptions extends RuntimePropsOptions
|
||||
? {}
|
||||
: ExtractPropTypes<RuntimePropsOptions>
|
||||
: { [key in RuntimePropsKeys]?: any }
|
||||
? keyof TypeProps extends never
|
||||
? string extends RuntimePropsKeys
|
||||
? ComponentObjectPropsOptions extends RuntimePropsOptions
|
||||
? {}
|
||||
: ExtractPropTypes<RuntimePropsOptions>
|
||||
: { [key in RuntimePropsKeys]?: any }
|
||||
: TypeProps
|
||||
: TypeProps,
|
||||
TypeRefs extends Record<string, unknown> = {},
|
||||
TypeEl extends Element = any,
|
||||
|
@ -125,7 +125,9 @@ type InferPropType<T, NullAsAny = true> = [T] extends [null]
|
||||
: InferPropType<U, false>
|
||||
: [T] extends [Prop<infer V, infer D>]
|
||||
? unknown extends V
|
||||
? IfAny<V, V, D>
|
||||
? keyof V extends never
|
||||
? IfAny<V, V, D>
|
||||
: V
|
||||
: V
|
||||
: T
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user