Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(types): prioritize promise based push/replace
  • Loading branch information
posva committed Aug 8, 2019
1 parent ff8abe0 commit 1243e8b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions types/router.d.ts
Expand Up @@ -23,10 +23,10 @@ export declare class VueRouter {
beforeEach (guard: NavigationGuard): Function;
beforeResolve (guard: NavigationGuard): Function;
afterEach (hook: (to: Route, from: Route) => any): Function;
push (location: RawLocation, onComplete?: Function, onAbort?: ErrorHandler): void;
replace (location: RawLocation, onComplete?: Function, onAbort?: ErrorHandler): void;
push (location: RawLocation): Promise<Route>;
replace (location: RawLocation): Promise<Route>;
push (location: RawLocation, onComplete?: Function, onAbort?: ErrorHandler): void;
replace (location: RawLocation, onComplete?: Function, onAbort?: ErrorHandler): void;
go (n: number): void;
back (): void;
forward (): void;
Expand Down
11 changes: 10 additions & 1 deletion types/test/index.ts
Expand Up @@ -159,7 +159,16 @@ router.push({
router.replace({ name: "home" });

router.push('/', () => {}, () => {})
router.replace('/foo', () => {}, () => {});
router.replace('/foo', () => {}, () => {})

// promises

router
.push('/')
.then(route => {
route.fullPath
})
.catch(() => {})

router.onReady(() => {});

Expand Down

0 comments on commit 1243e8b

Please sign in to comment.