Skip to content

Commit 6fd0c7c

Browse files
committed
refactor: use mount signatures for shallowMount
1 parent 9f97e85 commit 6fd0c7c

File tree

1 file changed

+2
-37
lines changed

1 file changed

+2
-37
lines changed

src/mount.ts

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -245,41 +245,6 @@ export function mount(
245245
return createWrapper(app, App, setProps)
246246
}
247247

248-
// Functional component
249-
export function shallowMount<TestedComponent extends FunctionalComponent>(
250-
originalComponent: TestedComponent,
251-
options?: MountingOptions<any>
252-
): VueWrapper<ComponentPublicInstance>
253-
// Component declared with defineComponent
254-
export function shallowMount<TestedComponent extends ComponentPublicInstance>(
255-
originalComponent: { new (): TestedComponent } & Component,
256-
options?: MountingOptions<TestedComponent['$props']>
257-
): VueWrapper<TestedComponent>
258-
// Component declared with { props: { ... } }
259-
export function shallowMount<
260-
TestedComponent extends ComponentOptionsWithObjectProps
261-
>(
262-
originalComponent: TestedComponent,
263-
options?: MountingOptions<ExtractPropTypes<TestedComponent['props'], false>>
264-
): VueWrapper<ExtractComponent<TestedComponent>>
265-
// Component declared with { props: [] }
266-
export function shallowMount<
267-
TestedComponent extends ComponentOptionsWithArrayProps
268-
>(
269-
originalComponent: TestedComponent,
270-
options?: MountingOptions<Record<string, any>>
271-
): VueWrapper<ExtractComponent<TestedComponent>>
272-
// Component declared with no props
273-
export function shallowMount<
274-
TestedComponent extends ComponentOptionsWithoutProps,
275-
ComponentT extends ComponentOptionsWithoutProps & {}
276-
>(
277-
originalComponent: ComponentT extends { new (): any } ? never : ComponentT,
278-
options?: MountingOptions<never>
279-
): VueWrapper<ExtractComponent<TestedComponent>>
280-
export function shallowMount(
281-
originalComponent: any,
282-
options?: MountingOptions<any>
283-
) {
284-
return mount(originalComponent, { ...options, shallow: true })
248+
export const shallowMount: typeof mount = (component: any, options?: any) => {
249+
return mount(component, { ...options, shallow: true })
285250
}

0 commit comments

Comments
 (0)