Skip to content

Commit a3804aa

Browse files
committed
chore: update nextjs-routes
1 parent b0824f0 commit a3804aa

File tree

1 file changed

+25
-27
lines changed

1 file changed

+25
-27
lines changed

types/nextjs-routes.d.ts

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
22
// This file will be automatically regenerated when your Next.js server is running.
3-
// nextjs-routes version: 2.2.1
3+
// nextjs-routes version: 2.2.2
44
/* eslint-disable */
55

66
// prettier-ignore
@@ -64,19 +64,26 @@ declare module "nextjs-routes" {
6464
[key: string]: string | string[] | undefined;
6565
};
6666

67-
export type RoutedQuery<P extends Route["pathname"]> = Extract<
67+
export type RoutedQuery<P extends Route["pathname"] = Route["pathname"]> = Extract<
6868
Route,
6969
{ pathname: P }
7070
>["query"];
7171

7272
export type Locale = undefined;
7373

74+
type Brand<K, T> = K & { __brand: T };
75+
76+
/**
77+
* A string that is a valid application route.
78+
*/
79+
export type RouteLiteral = Brand<string, "RouteLiteral">
80+
7481
/**
7582
* A typesafe utility function for generating paths in your application.
7683
*
7784
* route({ pathname: "/foos/[foo]", query: { foo: "bar" }}) will produce "/foos/bar".
7885
*/
79-
export declare function route(r: Route): string;
86+
export declare function route(r: Route): RouteLiteral;
8087

8188
/**
8289
* Nearly identical to GetServerSidePropsContext from next, but further narrows
@@ -108,37 +115,28 @@ declare module "nextjs-routes" {
108115

109116
// prettier-ignore
110117
declare module "next/link" {
111-
import type { Route } from "nextjs-routes";
118+
import type { Route } from "nextjs-routes";;
112119
import type { LinkProps as NextLinkProps } from "next/dist/client/link";
113-
import type {
114-
AnchorHTMLAttributes,
115-
DetailedReactHTMLElement,
116-
MouseEventHandler,
117-
PropsWithChildren,
118-
} from "react";
119-
export * from "next/dist/client/link";
120+
import type React from "react";
120121

121122
type StaticRoute = Exclude<Route, { query: any }>["pathname"];
122123

123-
export interface LinkProps
124-
extends Omit<NextLinkProps, "href" | "locale">,
125-
AnchorHTMLAttributes<HTMLAnchorElement> {
126-
href: Route | StaticRoute | Omit<Route, "pathname">
124+
export type LinkProps = Omit<NextLinkProps, "href" | "locale"> & {
125+
href: Route | StaticRoute | Omit<Route, "pathname">;
127126
locale?: false;
128127
}
129128

130-
type LinkReactElement = DetailedReactHTMLElement<
131-
{
132-
onMouseEnter?: MouseEventHandler<Element> | undefined;
133-
onClick: MouseEventHandler;
134-
href?: string | undefined;
135-
ref?: any;
136-
},
137-
HTMLElement
138-
>;
139-
140-
declare function Link(props: PropsWithChildren<LinkProps>): LinkReactElement;
141-
129+
/**
130+
* A React component that extends the HTML `<a>` element to provide [prefetching](https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating#2-prefetching)
131+
* and client-side navigation between routes.
132+
*
133+
* It is the primary way to navigate between routes in Next.js.
134+
*
135+
* Read more: [Next.js docs: `<Link>`](https://nextjs.org/docs/app/api-reference/components/link)
136+
*/
137+
declare const Link: React.ForwardRefExoticComponent<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof LinkProps> & LinkProps & {
138+
children?: React.ReactNode;
139+
} & React.RefAttributes<HTMLAnchorElement>>;
142140
export default Link;
143141
}
144142

0 commit comments

Comments
 (0)