Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stub Route type for typedRoutes #48099

Merged
merged 5 commits into from
May 10, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/next/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ export type {
ResolvingMetadata, // @ts-ignore This path is generated at build time and conflicts otherwise
} from '../dist/lib/metadata/types/metadata-interface'

/**
* Stub route type for typedRoutes before `next dev` or `next build` is run
* @link https://beta.nextjs.org/docs/configuring/typescript#statically-typed-links
* @example
* ```ts
* import type { Route } from 'next'
* // ...
* router.push(returnToPath as Route)
* ```
*/
export type Route = string & {};

// Extend the React types with missing properties
declare module 'react' {
// <html amp=""> support
Expand Down