Skip to content

Commit

Permalink
fix: take data option into account
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Apr 11, 2023
1 parent 686a5d6 commit f2be9d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/mount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ type ShimSlotReturnType<T> = T extends (...args: infer P) => any

type WithArray<T> = T | T[]

type ComponentData<T> = T extends { data?(...args: any): infer D } ? D : {}

export type ComponentMountingOptions<T> = Omit<
MountingOptions<ComponentProps<T>>,
MountingOptions<ComponentProps<T>, ComponentData<T>>,
'slots'
> & {
slots?: {
Expand Down Expand Up @@ -45,7 +47,7 @@ export function mount<
>(
originalComponent: T,
options?: ComponentMountingOptions<C>
): VueWrapper<ComponentExposed<C> & ComponentProps<C>>
): VueWrapper<ComponentExposed<C> & ComponentProps<C> & ComponentData<C>>

// implementation
export function mount(
Expand Down
2 changes: 1 addition & 1 deletion src/vueWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function createVMProxy<T extends ComponentPublicInstance>(

export class VueWrapper<
VM = unknown,
T extends VM & ComponentPublicInstance = VM & ComponentPublicInstance
T extends ComponentPublicInstance = VM & ComponentPublicInstance
> extends BaseWrapper<Node> {
private readonly componentVM: T
private readonly rootVM: ComponentPublicInstance | undefined | null
Expand Down

0 comments on commit f2be9d5

Please sign in to comment.