Skip to content

Commit f2be9d5

Browse files
committed
fix: take data option into account
1 parent 686a5d6 commit f2be9d5

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/mount.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ type ShimSlotReturnType<T> = T extends (...args: infer P) => any
1616

1717
type WithArray<T> = T | T[]
1818

19+
type ComponentData<T> = T extends { data?(...args: any): infer D } ? D : {}
20+
1921
export type ComponentMountingOptions<T> = Omit<
20-
MountingOptions<ComponentProps<T>>,
22+
MountingOptions<ComponentProps<T>, ComponentData<T>>,
2123
'slots'
2224
> & {
2325
slots?: {
@@ -45,7 +47,7 @@ export function mount<
4547
>(
4648
originalComponent: T,
4749
options?: ComponentMountingOptions<C>
48-
): VueWrapper<ComponentExposed<C> & ComponentProps<C>>
50+
): VueWrapper<ComponentExposed<C> & ComponentProps<C> & ComponentData<C>>
4951

5052
// implementation
5153
export function mount(

src/vueWrapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function createVMProxy<T extends ComponentPublicInstance>(
7070

7171
export class VueWrapper<
7272
VM = unknown,
73-
T extends VM & ComponentPublicInstance = VM & ComponentPublicInstance
73+
T extends ComponentPublicInstance = VM & ComponentPublicInstance
7474
> extends BaseWrapper<Node> {
7575
private readonly componentVM: T
7676
private readonly rootVM: ComponentPublicInstance | undefined | null

0 commit comments

Comments
 (0)