3
3
App ,
4
4
ComponentPublicInstance ,
5
5
VNode ,
6
- ExtractComponentEmits ,
7
- ComponentCustomProperties
6
+ ExtractComponentEmits
8
7
} from 'vue'
9
8
10
9
import { config } from './config'
@@ -95,23 +94,9 @@ type ResolveEmitRecord<T> = ExtractComponentEmits<T> extends infer E
95
94
}
96
95
: never
97
96
98
- declare const aaa : keyof Omit <
99
- ComponentPublicInstance ,
100
- keyof ComponentCustomProperties
101
- >
102
-
103
- // type BetterKeys = keyof Omit<
104
- // ComponentPublicInstance,
105
- // keyof ComponentCustomProperties
106
- // >
107
- // export type ComponentInstance = {
108
- // [K in keyof ComponentPublicInstance]?: any
109
- // } & Record<PropertyKey, any>
110
-
111
97
export class VueWrapper <
112
- T extends Omit < ComponentPublicInstance , '$emit' > & {
113
- $emit : any
114
- } = ComponentPublicInstance
98
+ VM = unknown ,
99
+ T extends ComponentPublicInstance = ComponentPublicInstance & VM
115
100
> extends BaseWrapper < Node > {
116
101
private readonly componentVM : T
117
102
private readonly rootVM : ComponentPublicInstance | undefined | null
@@ -251,7 +236,6 @@ export class VueWrapper<
251
236
get vm ( ) : T {
252
237
return this . componentVM
253
238
}
254
-
255
239
props ( ) : T [ '$props' ]
256
240
props < Selector extends keyof T [ '$props' ] > (
257
241
selector : Selector
@@ -264,9 +248,9 @@ export class VueWrapper<
264
248
}
265
249
266
250
emitted ( ) : ResolveEmitRecord < T >
267
- emitted < E extends ResolveComponentEmitKeys < T > > (
251
+ emitted < E extends ResolveComponentEmitKeys < VM > > (
268
252
eventName : E
269
- ) : undefined | ResolveEmitRecord < T > [ E ]
253
+ ) : undefined | ResolveEmitRecord < VM > [ E ]
270
254
emitted ( eventName ?: string ) {
271
255
return emitted ( this . vm , eventName )
272
256
}
0 commit comments