|
1 | 1 | // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. |
2 | 2 | // 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 |
4 | 4 | /* eslint-disable */ |
5 | 5 |
|
6 | 6 | // prettier-ignore |
@@ -64,19 +64,26 @@ declare module "nextjs-routes" { |
64 | 64 | [key: string]: string | string[] | undefined; |
65 | 65 | }; |
66 | 66 |
|
67 | | - export type RoutedQuery<P extends Route["pathname"]> = Extract< |
| 67 | + export type RoutedQuery<P extends Route["pathname"] = Route["pathname"]> = Extract< |
68 | 68 | Route, |
69 | 69 | { pathname: P } |
70 | 70 | >["query"]; |
71 | 71 |
|
72 | 72 | export type Locale = undefined; |
73 | 73 |
|
| 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 | + |
74 | 81 | /** |
75 | 82 | * A typesafe utility function for generating paths in your application. |
76 | 83 | * |
77 | 84 | * route({ pathname: "/foos/[foo]", query: { foo: "bar" }}) will produce "/foos/bar". |
78 | 85 | */ |
79 | | - export declare function route(r: Route): string; |
| 86 | + export declare function route(r: Route): RouteLiteral; |
80 | 87 |
|
81 | 88 | /** |
82 | 89 | * Nearly identical to GetServerSidePropsContext from next, but further narrows |
@@ -108,37 +115,28 @@ declare module "nextjs-routes" { |
108 | 115 |
|
109 | 116 | // prettier-ignore |
110 | 117 | declare module "next/link" { |
111 | | - import type { Route } from "nextjs-routes"; |
| 118 | + import type { Route } from "nextjs-routes";; |
112 | 119 | 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"; |
120 | 121 |
|
121 | 122 | type StaticRoute = Exclude<Route, { query: any }>["pathname"]; |
122 | 123 |
|
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">; |
127 | 126 | locale?: false; |
128 | 127 | } |
129 | 128 |
|
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>>; |
142 | 140 | export default Link; |
143 | 141 | } |
144 | 142 |
|
|
0 commit comments