From c9382eb335d567294e1c415294735bec59bfb598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Fontcuberta?= Date: Fri, 30 Jul 2021 15:47:20 +0200 Subject: [PATCH] Remove types from Router and Vuex --- types/index.d.ts | 19 ++++++++++++------- types/test.ts | 9 +-------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index e8dd853..122afd9 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -2,8 +2,6 @@ import Vue, {ComponentOptions} from 'vue' import {ThisTypedMountOptions, VueClass} from '@vue/test-utils' -import {Store, StoreOptions} from 'vuex' -import Router, {RouteConfig} from 'vue-router' // eslint-disable-next-line import/no-extraneous-dependencies import { queries, @@ -36,12 +34,19 @@ export interface RenderResult extends BoundFunctions { updateProps(props: object): Promise } -export interface RenderOptions +// eslint-disable-next-line @typescript-eslint/no-explicit-any +type Store = any +// eslint-disable-next-line @typescript-eslint/no-explicit-any +type Routes = any +// eslint-disable-next-line @typescript-eslint/no-explicit-any +type Router = any + +export interface RenderOptions // The props and store options special-cased by Vue Testing Library and NOT passed to mount(). extends Omit, 'store' | 'props'> { props?: object - store?: StoreOptions - routes?: RouteConfig[] | Router + store?: Store + routes?: Routes container?: Element baseElement?: Element } @@ -50,11 +55,11 @@ export type ConfigurationCallback = | (( localVue: typeof Vue, // eslint-disable-next-line @typescript-eslint/no-explicit-any - store: Store, + store: Store, router: Router, ) => Partial>) // eslint-disable-next-line @typescript-eslint/no-explicit-any - | ((localVue: typeof Vue, store: Store, router: Router) => void) + | ((localVue: typeof Vue, store: Store, router: Router) => void) export function render( TestComponent: VueClass | ComponentOptions, diff --git a/types/test.ts b/types/test.ts index 31027e4..f749e4c 100644 --- a/types/test.ts +++ b/types/test.ts @@ -110,11 +110,6 @@ export function testOptions() { foos: [4, 5], bars: ['a', 'b'], }, - getters: { - fooCount() { - return this.foos.length - }, - }, }, routes: [ {path: '/', name: 'home', component: SomeComponent}, @@ -129,10 +124,8 @@ export function testOptions() { export function testConfigCallback() { const ExamplePlugin: Vue.PluginFunction = () => {} - render(SomeComponent, {}, (localVue, store, router) => { + render(SomeComponent, {}, localVue => { localVue.use(ExamplePlugin) - store.replaceState({foo: 'bar'}) - router.onError(error => console.log(error.message)) }) }