diff --git a/types/router.d.ts b/types/router.d.ts index 4d4c6a1d1..bed016ee0 100644 --- a/types/router.d.ts +++ b/types/router.d.ts @@ -1,7 +1,7 @@ import Vue = require("vue"); -import { ComponentOptions, PluginFunction } from "vue"; +import { ComponentOptions, PluginFunction, AsyncComponent } from "vue"; -type Component = ComponentOptions | typeof Vue; +type Component = ComponentOptions | typeof Vue | AsyncComponent; type Dictionary = { [key: string]: T }; export type RouterMode = "hash" | "history" | "abstract"; diff --git a/types/test/index.ts b/types/test/index.ts index 5fc8a51fc..9a0bc3612 100644 --- a/types/test/index.ts +++ b/types/test/index.ts @@ -9,6 +9,7 @@ Vue.use(VueRouter); const Home = { template: "
home
" }; const Foo = { template: "
foo
" }; const Bar = { template: "
bar
" }; +const AsyncComponent = () => Promise.resolve({ template: "
async
" }) const Hook: ComponentOptions = { template: "
hook
", @@ -66,7 +67,8 @@ const router = new VueRouter({ path: "child", components: { default: Foo, - bar: Bar + bar: Bar, + asyncComponent: AsyncComponent, }, meta: { auth: true }, beforeEnter (to, from, next) {