@@ -17,7 +17,12 @@ import {
17
17
ComponentPropsOptions ,
18
18
AppConfig ,
19
19
VNodeProps ,
20
- ComponentOptionsMixin
20
+ ComponentOptionsMixin ,
21
+ DefineComponent ,
22
+ MethodOptions ,
23
+ AllowedComponentProps ,
24
+ ComponentCustomProps ,
25
+ ExtractDefaultPropTypes
21
26
} from 'vue'
22
27
23
28
import { config } from './config'
@@ -34,6 +39,8 @@ import {
34
39
} from './constants'
35
40
import { stubComponents } from './stubs'
36
41
42
+ type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps
43
+
37
44
type Slot = VNode | string | { render : Function } | Function | Component
38
45
39
46
type SlotDictionary = {
@@ -46,6 +53,7 @@ interface MountingOptions<Props, Data = {}> {
46
53
: Data extends object
47
54
? Partial < Data >
48
55
: never
56
+ // data?: {} extends Data ? never : () => Partial<Data>
49
57
props ?: Props
50
58
/** @deprecated */
51
59
propsData ?: Props
@@ -78,10 +86,60 @@ export function mount<
78
86
) : VueWrapper < ComponentPublicInstance < Props > >
79
87
80
88
// Component declared with defineComponent
81
- export function mount < TestedComponent extends ComponentPublicInstance > (
82
- originalComponent : { new ( ) : TestedComponent } & Component ,
83
- options ?: MountingOptions < TestedComponent [ '$props' ] , TestedComponent [ '$data' ] >
84
- ) : VueWrapper < TestedComponent >
89
+ // export function mount<TestedComponent extends ComponentPublicInstance>(
90
+ // originalComponent: { new (): TestedComponent } & Component,
91
+ // options?: MountingOptions<TestedComponent['$props'], TestedComponent['$data']>
92
+ // ): VueWrapper<TestedComponent>
93
+
94
+ export function mount <
95
+ PropsOrPropOptions = { } ,
96
+ RawBindings = { } ,
97
+ D = { } ,
98
+ C extends ComputedOptions = ComputedOptions ,
99
+ M extends MethodOptions = MethodOptions ,
100
+ Mixin extends ComponentOptionsMixin = ComponentOptionsMixin ,
101
+ Extends extends ComponentOptionsMixin = ComponentOptionsMixin ,
102
+ E extends EmitsOptions = Record < string , any > ,
103
+ EE extends string = string ,
104
+ PP = PublicProps ,
105
+ Props = Readonly < ExtractPropTypes < PropsOrPropOptions > > ,
106
+ Defaults = ExtractDefaultPropTypes < PropsOrPropOptions >
107
+ > (
108
+ component : DefineComponent <
109
+ PropsOrPropOptions ,
110
+ RawBindings ,
111
+ D ,
112
+ C ,
113
+ M ,
114
+ Mixin ,
115
+ Extends ,
116
+ E ,
117
+ EE ,
118
+ PP ,
119
+ Props ,
120
+ Defaults
121
+ > ,
122
+ options ?: MountingOptions < Props , D >
123
+ ) : VueWrapper <
124
+ InstanceType <
125
+ DefineComponent <
126
+ PropsOrPropOptions ,
127
+ RawBindings ,
128
+ D ,
129
+ C ,
130
+ M ,
131
+ Mixin ,
132
+ Extends ,
133
+ E ,
134
+ EE ,
135
+ PP ,
136
+ Props ,
137
+ Defaults
138
+ >
139
+ >
140
+ >
141
+
142
+ //Props //VueWrapper<InstanceType<C>> //ExtractPropTypes<PropsOrOptions> //PropsOrOptions //VueWrapper<ThisType<C>>
85
143
86
144
// Component declared with no props
87
145
export function mount <
0 commit comments