Skip to content
Prev Previous commit
Next Next commit
set deep partial
  • Loading branch information
pikax committed Nov 20, 2023
commit a33efb15bc6cdbd55ba59daf14ba0dcc6ec52412
6 changes: 5 additions & 1 deletion src/vueWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ type ResolveEmitRecord<T> = ExtractComponentEmits<T> extends infer E
}
: never

type DeepPartial<T> = {
[P in keyof T]?: DeepPartial<T[P]>
}

export class VueWrapper<
VM = unknown,
T extends ComponentPublicInstance = ComponentPublicInstance & VM
Expand Down Expand Up @@ -265,7 +269,7 @@ export class VueWrapper<
return domWrapper.isVisible()
}

setData(data: Partial<T['$data']>): Promise<void> {
setData(data: DeepPartial<T['$data']>): Promise<void> {
mergeDeep(this.componentVM.$data, data)
return nextTick()
}
Expand Down