Skip to content

Commit 798b58c

Browse files
committed
chore: improve class component overload and pass dts
1 parent 37fe25e commit 798b58c

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/mount.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {
2727
import { config } from './config'
2828
import { GlobalMountOptions } from './types'
2929
import {
30-
isClassComponent,
3130
isFunctionalComponent,
3231
isObjectComponent,
3332
mergeGlobalProperties
@@ -73,9 +72,12 @@ export type ObjectEmitsOptions = Record<
7372
export type EmitsOptions = ObjectEmitsOptions | string[]
7473

7574
// Class component
76-
export function mount<V>(
77-
originalComponent: new (...args: any[]) => V,
78-
options?: MountingOptions<any>
75+
export function mount<V, P>(
76+
originalComponent: {
77+
new (...args: any[]): V
78+
props(Props: P)
79+
},
80+
options?: MountingOptions<P>
7981
): VueWrapper<ComponentPublicInstance<V>>
8082

8183
// Functional component with emits

test-dts/shallowMount.d-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,5 +119,5 @@ class ClassComponent extends Vue {
119119
}
120120

121121
// @ts-expect-error it requires an argument
122-
expectError(mount(ClassComponent, {}).vm.changeMessage())
122+
expectError(shallowMount(ClassComponent, {}).vm.changeMessage())
123123
shallowMount(ClassComponent, {}).vm.changeMessage('')

0 commit comments

Comments
 (0)