You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/runtime-core/src/componentProps.ts
+9-7
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,7 @@ type PropConstructor<T = any> =
60
60
|{(): T}
61
61
|PropMethod<T>
62
62
63
-
typePropMethod<T,TConstructor=any>=Textends(...args: any)=>any// if is function with args
63
+
typePropMethod<T,TConstructor=any>=[T]extends[(...args: any)=>any]// if is function with args
64
64
? {new(): TConstructor;(): T;readonlyprototype: TConstructor}// Create Function like constructor
65
65
: never
66
66
@@ -89,17 +89,19 @@ type DefaultKeys<T> = {
89
89
: never
90
90
}[keyofT]
91
91
92
-
typeInferPropType<T>=Textendsnull
92
+
typeInferPropType<T>=[T]extends[null]
93
93
? any// null & true would fail to infer
94
-
: Textends{type: null|true}
94
+
: [T]extends[{type: null|true}]
95
95
? any// As TS issue https://github.com/Microsoft/TypeScript/issues/14829 // somehow `ObjectConstructor` when inferred from { (): T } becomes `any` // `BooleanConstructor` when inferred from PropConstructor(with PropMethod) becomes `Boolean`
0 commit comments