File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { createRouter , createWebHistory , expectType } from './index'
2
+ import { NavigationFailure } from 'dist/vue-router'
3
+
4
+ const router = createRouter ( {
5
+ history : createWebHistory ( ) ,
6
+ routes : [ ] ,
7
+ } )
8
+
9
+ router . beforeEach ( ( to , from ) => {
10
+ return { path : '/' }
11
+ } )
12
+
13
+ router . beforeEach ( ( to , from ) => {
14
+ return '/'
15
+ } )
16
+
17
+ router . beforeEach ( ( to , from ) => {
18
+ return false
19
+ } )
20
+
21
+ // @ts -expect-error
22
+ router . beforeEach ( ( to , from , next ) => {
23
+ return Symbol ( 'not supported' )
24
+ } )
25
+ // @ts -expect-error
26
+ router . beforeEach ( ( ) => {
27
+ return Symbol ( 'not supported' )
28
+ } )
29
+
30
+ router . beforeEach ( ( to , from , next ) => {
31
+ // @ts -expect-error
32
+ next ( Symbol ( 'not supported' ) )
33
+ } )
34
+
35
+ router . afterEach ( ( to , from , failure ) => {
36
+ expectType < NavigationFailure | undefined | void > ( failure )
37
+ } )
You can’t perform that action at this time.
0 commit comments