Skip to content

Commit

Permalink
Fix type error with router.push path
Browse files Browse the repository at this point in the history
  • Loading branch information
karlhorky committed Apr 7, 2023
1 parent 9f8922e commit 9b526e3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/(auth)/login/LoginForm.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client';

import { Route } from 'next';
import { useRouter } from 'next/navigation';
import { useState } from 'react';
import { getSafeReturnToPath } from '../../../util/validation';
Expand Down Expand Up @@ -46,7 +47,7 @@ username: bob / password: def`}</pre>
const returnTo = getSafeReturnToPath(props.returnTo);

if (returnTo) {
router.push(returnTo);
router.push(returnTo as Route);
return;
}

Expand Down
11 changes: 11 additions & 0 deletions patches/next@13.3.0.patch
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,14 @@ index 268f52b1f12c2f1bb9d71f7c51d8dd6cf3194ac8..2b6b94bd8b68338be31b89cdbee01d7e
static redirect(url: string | NextURL | URL, init?: number | ResponseInit): NextResponse;
static rewrite(destination: string | NextURL | URL, init?: MiddlewareResponseInit): NextResponse;
static next(init?: MiddlewareResponseInit): NextResponse;
diff --git a/index.d.ts b/index.d.ts
index cba2b1dd4e056208cfc9b34af23b90095bf8a661..853c978956a9d386cf6ea22c2c9d62b9dca3e17a 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -13,5 +13,6 @@
/// <reference path="./script.d.ts" />
/// <reference path="./server.d.ts" />

+export type Route = string & {};
export { default } from './types'
export * from './types'
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9b526e3

Please sign in to comment.