Skip to content

Commit 1243e8b

Browse files
committed
fix(types): prioritize promise based push/replace
1 parent ff8abe0 commit 1243e8b

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

types/router.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ export declare class VueRouter {
2323
beforeEach (guard: NavigationGuard): Function;
2424
beforeResolve (guard: NavigationGuard): Function;
2525
afterEach (hook: (to: Route, from: Route) => any): Function;
26-
push (location: RawLocation, onComplete?: Function, onAbort?: ErrorHandler): void;
27-
replace (location: RawLocation, onComplete?: Function, onAbort?: ErrorHandler): void;
2826
push (location: RawLocation): Promise<Route>;
2927
replace (location: RawLocation): Promise<Route>;
28+
push (location: RawLocation, onComplete?: Function, onAbort?: ErrorHandler): void;
29+
replace (location: RawLocation, onComplete?: Function, onAbort?: ErrorHandler): void;
3030
go (n: number): void;
3131
back (): void;
3232
forward (): void;

types/test/index.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,16 @@ router.push({
159159
router.replace({ name: "home" });
160160

161161
router.push('/', () => {}, () => {})
162-
router.replace('/foo', () => {}, () => {});
162+
router.replace('/foo', () => {}, () => {})
163+
164+
// promises
165+
166+
router
167+
.push('/')
168+
.then(route => {
169+
route.fullPath
170+
})
171+
.catch(() => {})
163172

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

0 commit comments

Comments
 (0)