Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9d367e7

Browse files
authored
fix(types): Remove Router and Vuex dependencies (#246)
1 parent eba2aed commit 9d367e7

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

‎types/index.d.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
import Vue, {ComponentOptions} from 'vue'
44
import {ThisTypedMountOptions, VueClass} from '@vue/test-utils'
5-
import {Store, StoreOptions} from 'vuex'
6-
import Router, {RouteConfig} from 'vue-router'
75
// eslint-disable-next-line import/no-extraneous-dependencies
86
import {
97
queries,
@@ -36,12 +34,19 @@ export interface RenderResult extends BoundFunctions<typeof queries> {
3634
updateProps(props: object): Promise<void>
3735
}
3836

39-
export interface RenderOptions<V extends Vue, S = {}>
37+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
38+
type Store = any
39+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
40+
type Routes = any
41+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
42+
type Router = any
43+
44+
export interface RenderOptions<V extends Vue>
4045
// The props and store options special-cased by Vue Testing Library and NOT passed to mount().
4146
extends Omit<ThisTypedMountOptions<V>, 'store' | 'props'> {
4247
props?: object
43-
store?: StoreOptions<S>
44-
routes?: RouteConfig[]|Router
48+
store?: Store
49+
routes?: Routes
4550
container?: Element
4651
baseElement?: Element
4752
}
@@ -50,11 +55,11 @@ export type ConfigurationCallback<V extends Vue> =
5055
| ((
5156
localVue: typeof Vue,
5257
// eslint-disable-next-line @typescript-eslint/no-explicit-any
53-
store: Store<any>,
58+
store: Store,
5459
router: Router,
5560
) => Partial<ThisTypedMountOptions<V>>)
5661
// eslint-disable-next-line @typescript-eslint/no-explicit-any
57-
| ((localVue: typeof Vue, store: Store<any>, router: Router) => void)
62+
| ((localVue: typeof Vue, store: Store, router: Router) => void)
5863

5964
export function render<V extends Vue>(
6065
TestComponent: VueClass<V> | ComponentOptions<V>,

‎types/test.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,6 @@ export function testOptions() {
110110
foos: [4, 5],
111111
bars: ['a', 'b'],
112112
},
113-
getters: {
114-
fooCount() {
115-
return this.foos.length
116-
},
117-
},
118113
},
119114
routes: [
120115
{path: '/', name: 'home', component: SomeComponent},
@@ -129,10 +124,8 @@ export function testOptions() {
129124

130125
export function testConfigCallback() {
131126
const ExamplePlugin: Vue.PluginFunction<never> = () => {}
132-
render(SomeComponent, {}, (localVue,store,router) => {
127+
render(SomeComponent, {}, localVue => {
133128
localVue.use(ExamplePlugin)
134-
store.replaceState({foo: 'bar'})
135-
router.onError(error => console.log(error.message))
136129
})
137130
}
138131

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /