Skip to content

Commit 85a7663

Browse files
committed
test: types
1 parent 9d001dd commit 85a7663

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

types/test/index.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Vue, { ComponentOptions, AsyncComponent } from 'vue'
1+
import Vue, { ComponentOptions, AsyncComponent, Component } from 'vue'
22

33
import VueRouter from '../index'
44
import {
@@ -54,6 +54,11 @@ const Hook: ComponentOptions<Vue> = {
5454
}
5555
}
5656

57+
const JSXComponent = () => {
58+
$props: {
59+
}
60+
}
61+
5762
const router = new VueRouter({
5863
mode: 'history',
5964
base: '/',
@@ -104,7 +109,8 @@ const router = new VueRouter({
104109
default: Foo,
105110
bar: Bar,
106111
abc: Abc,
107-
asyncComponent: Async
112+
asyncComponent: Async,
113+
JSXComponent
108114
},
109115
meta: { auth: true, nested: { foo: '' } },
110116
beforeEnter(to, from, next) {
@@ -154,7 +160,7 @@ const matched: RouteRecord[] = route.matched
154160
matched.forEach(m => {
155161
const path: string = m.path
156162
const components: {
157-
[key: string]: ComponentOptions<Vue> | typeof Vue | AsyncComponent
163+
[key: string]: Component | AsyncComponent | {}
158164
} = m.components
159165
const instances: { [key: string]: Vue } = m.instances
160166
const name: string | undefined | null = m.name
@@ -226,9 +232,9 @@ router.back()
226232
router.forward()
227233

228234
const Components: (
229-
| ComponentOptions<Vue>
230-
| typeof Vue
235+
| Component
231236
| AsyncComponent
237+
| {}
232238
)[] = router.getMatchedComponents()
233239

234240
const match: Route = router.match('/more')

0 commit comments

Comments
 (0)