@@ -39,6 +39,7 @@ import { createPropsDefaultThis } from './compat/props'
|
||||
import { isCompatEnabled, softAssertCompatEnabled } from './compat/compatConfig'
|
||||
import { DeprecationTypes } from './compat/compatConfig'
|
||||
import { shouldSkipAttr } from './compat/attrsFallthrough'
|
||||
import { IfAny } from './helpers/typeUtils'
|
||||
|
||||
export type ComponentPropsOptions<P = Data> =
|
||||
| ComponentObjectPropsOptions<P>
|
||||
@@ -115,7 +116,7 @@ type InferPropType<T> = [T] extends [null]
|
||||
: InferPropType<U>
|
||||
: [T] extends [Prop<infer V, infer D>]
|
||||
? unknown extends V
|
||||
? D
|
||||
? IfAny<V, V, D>
|
||||
: V
|
||||
: T
|
||||
|
||||
|
||||
@@ -6,3 +6,5 @@ export type UnionToIntersection<U> = (
|
||||
|
||||
// make keys required but keep undefined values
|
||||
export type LooseRequired<T> = { [P in string & keyof T]: T[P] }
|
||||
|
||||
export type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N
|
||||
|
||||
Reference in New Issue
Block a user