Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pikax committed Nov 16, 2023
1 parent 346b860 commit f4934bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
26 changes: 5 additions & 21 deletions src/vueWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import {
App,
ComponentPublicInstance,
VNode,
ExtractComponentEmits,
ComponentCustomProperties
ExtractComponentEmits
} from 'vue'

import { config } from './config'
Expand Down Expand Up @@ -95,23 +94,9 @@ type ResolveEmitRecord<T> = ExtractComponentEmits<T> extends infer E
}
: never

declare const aaa: keyof Omit<
ComponentPublicInstance,
keyof ComponentCustomProperties
>

// type BetterKeys = keyof Omit<
// ComponentPublicInstance,
// keyof ComponentCustomProperties
// >
// export type ComponentInstance = {
// [K in keyof ComponentPublicInstance]?: any
// } & Record<PropertyKey, any>

export class VueWrapper<
T extends Omit<ComponentPublicInstance, '$emit'> & {
$emit: any
} = ComponentPublicInstance
VM = unknown,
T extends ComponentPublicInstance = ComponentPublicInstance & VM
> extends BaseWrapper<Node> {
private readonly componentVM: T
private readonly rootVM: ComponentPublicInstance | undefined | null
Expand Down Expand Up @@ -251,7 +236,6 @@ export class VueWrapper<
get vm(): T {
return this.componentVM
}

props(): T['$props']
props<Selector extends keyof T['$props']>(
selector: Selector
Expand All @@ -264,9 +248,9 @@ export class VueWrapper<
}

emitted(): ResolveEmitRecord<T>
emitted<E extends ResolveComponentEmitKeys<T>>(
emitted<E extends ResolveComponentEmitKeys<VM>>(
eventName: E
): undefined | ResolveEmitRecord<T>[E]
): undefined | ResolveEmitRecord<VM>[E]
emitted(eventName?: string) {
return emitted(this.vm, eventName)
}
Expand Down
2 changes: 1 addition & 1 deletion src/wrapperFactory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComponentPublicInstance, App } from 'vue'
import { App, ComponentPublicInstance } from 'vue'
import type { DOMWrapper as DOMWrapperType } from './domWrapper'
import type { VueWrapper as VueWrapperType } from './vueWrapper'

Expand Down

0 comments on commit f4934bf

Please sign in to comment.