Skip to content

Commit a7dd72c

Browse files
committed
fix type test
1 parent deba65a commit a7dd72c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

types/test/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Vue = require("vue");
2-
import { ComponentOptions } from "vue";
2+
import { ComponentOptions, AsyncComponent } from "vue";
33

44
import VueRouter = require("../index");
55
import { Route, RouteRecord, RedirectOption } from "../index";
@@ -9,7 +9,7 @@ Vue.use(VueRouter);
99
const Home = { template: "<div>home</div>" };
1010
const Foo = { template: "<div>foo</div>" };
1111
const Bar = { template: "<div>bar</div>" };
12-
const AsyncComponent = () => Promise.resolve({ template: "<div>async</div>" })
12+
const Async = () => Promise.resolve({ template: "<div>async</div>" })
1313

1414
const Hook: ComponentOptions<Vue> = {
1515
template: "<div>hook</div>",
@@ -68,7 +68,7 @@ const router = new VueRouter({
6868
components: {
6969
default: Foo,
7070
bar: Bar,
71-
asyncComponent: AsyncComponent,
71+
asyncComponent: Async,
7272
},
7373
meta: { auth: true },
7474
beforeEnter (to, from, next) {
@@ -111,7 +111,7 @@ const matched: RouteRecord[] = route.matched;
111111
matched.forEach(m => {
112112
const path: string = m.path;
113113
const components: {
114-
[key: string]: ComponentOptions<Vue> | typeof Vue
114+
[key: string]: ComponentOptions<Vue> | typeof Vue | AsyncComponent
115115
} = m.components;
116116
const instances: { [key: string]: Vue } = m.instances;
117117
const name: string | undefined = m.name;
@@ -163,7 +163,7 @@ router.go(-1);
163163
router.back();
164164
router.forward();
165165

166-
const Components: (ComponentOptions<Vue> | typeof Vue)[] = router.getMatchedComponents();
166+
const Components: (ComponentOptions<Vue> | typeof Vue | AsyncComponent)[] = router.getMatchedComponents();
167167

168168
const vm = new Vue({
169169
router,

0 commit comments

Comments
 (0)