-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnextjs-routes.d.ts
178 lines (160 loc) · 6.03 KB
/
nextjs-routes.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
// This file will be automatically regenerated when your Next.js server is running.
// nextjs-routes version: 1.0.8
/* eslint-disable */
// prettier-ignore
declare module "nextjs-routes" {
export type Route =
| DynamicRoute<"/admin/[id]", { "id": string }>
| StaticRoute<"/admin">
| DynamicRoute<"/albums/[id]", { "id": string }>
| DynamicRoute<"/albums/[id]/settings", { "id": string }>
| StaticRoute<"/api/audiveris">
| DynamicRoute<"/api/auth/[...nextauth]", { "nextauth": string[] }>
| StaticRoute<"/api/restricted">
| DynamicRoute<"/api/trpc/[trpc]", { "trpc": string }>
| DynamicRoute<"/artists/[id]", { "id": string }>
| DynamicRoute<"/artists/[id]/settings", { "id": string }>
| StaticRoute<"/auth/signin">
| DynamicRoute<"/bands/[id]", { "id": string }>
| DynamicRoute<"/bands/[id]/settings", { "id": string }>
| StaticRoute<"/cart">
| StaticRoute<"/dashboard/credits">
| StaticRoute<"/dashboard">
| StaticRoute<"/dashboard/library">
| StaticRoute<"/dashboard/notifications">
| StaticRoute<"/dashboard/settings">
| DynamicRoute<"/dashboard/transactions/[id]", { "id": string }>
| StaticRoute<"/dashboard/transactions">
| StaticRoute<"/docs/developer">
| StaticRoute<"/docs/getting-started/create-music">
| StaticRoute<"/docs/getting-started">
| StaticRoute<"/docs/getting-started/write-score">
| StaticRoute<"/docs/hakei-prod">
| StaticRoute<"/docs">
| StaticRoute<"/">
| DynamicRoute<"/musics/[id]", { "id": string }>
| DynamicRoute<"/musics/[id]/issues/[issueId]", { "id": string; "issueId": string }>
| DynamicRoute<"/musics/[id]/issues", { "id": string }>
| DynamicRoute<"/musics/[id]/issues/new", { "id": string }>
| DynamicRoute<"/musics/[id]/pulls/[pullId]/code", { "id": string; "pullId": string }>
| DynamicRoute<"/musics/[id]/pulls/[pullId]", { "id": string; "pullId": string }>
| DynamicRoute<"/musics/[id]/pulls/[pullId]/score/edit", { "id": string; "pullId": string }>
| DynamicRoute<"/musics/[id]/pulls/[pullId]/score", { "id": string; "pullId": string }>
| DynamicRoute<"/musics/[id]/pulls", { "id": string }>
| DynamicRoute<"/musics/[id]/pulls/new", { "id": string }>
| DynamicRoute<"/musics/[id]/score/edit", { "id": string }>
| DynamicRoute<"/musics/[id]/score", { "id": string }>
| DynamicRoute<"/musics/[id]/settings", { "id": string }>
| StaticRoute<"/new">
| StaticRoute<"/pay">
| StaticRoute<"/search">
| StaticRoute<"/thanks">
| DynamicRoute<"/users/[id]/bookmarks", { "id": string }>
| DynamicRoute<"/users/[id]/followers", { "id": string }>
| DynamicRoute<"/users/[id]/following", { "id": string }>
| DynamicRoute<"/users/[id]", { "id": string }>
| DynamicRoute<"/users/[id]/repositories", { "id": string }>
| StaticRoute<"/users">;
interface StaticRoute<Pathname> {
pathname: Pathname;
query?: Query | undefined;
hash?: string | null | undefined;
}
interface DynamicRoute<Pathname, Parameters> {
pathname: Pathname;
query: Parameters & Query;
hash?: string | null | undefined;
}
interface Query {
[key: string]: string | string[] | undefined;
};
export type RoutedQuery<P extends Route["pathname"]> = Extract<
Route,
{ pathname: P }
>["query"];
export type Locale =
| "en"
| "ja";
/**
* A typesafe utility function for generating paths in your application.
*
* route({ pathname: "/foos/[foo]", query: { foo: "bar" }}) will produce "/foos/bar".
*/
export declare function route(r: Route): string;
}
// prettier-ignore
declare module "next/link" {
import type { Route } from "nextjs-routes";
import type { LinkProps as NextLinkProps } from "next/dist/client/link";
import type {
AnchorHTMLAttributes,
DetailedReactHTMLElement,
MouseEventHandler,
PropsWithChildren,
} from "react";
export * from "next/dist/client/link";
type Query = { query?: { [key: string]: string | string[] | undefined } };
type StaticRoute = Exclude<Route, { query: any }>["pathname"];
export interface LinkProps
extends Omit<NextLinkProps, "href" | "locale">,
AnchorHTMLAttributes<HTMLAnchorElement> {
href: Route | StaticRoute | Query;
locale?: Locale | false;
}
type LinkReactElement = DetailedReactHTMLElement<
{
onMouseEnter?: MouseEventHandler<Element> | undefined;
onClick: MouseEventHandler;
href?: string | undefined;
ref?: any;
},
HTMLElement
>;
declare function Link(props: PropsWithChildren<LinkProps>): LinkReactElement;
export default Link;
}
// prettier-ignore
declare module "next/router" {
import type { Locale, Route, RoutedQuery } from "nextjs-routes";
import type { NextRouter as Router } from "next/dist/client/router";
export * from "next/dist/client/router";
export { default } from "next/dist/client/router";
type NextTransitionOptions = NonNullable<Parameters<Router["push"]>[2]>;
type StaticRoute = Exclude<Route, { query: any }>["pathname"];
type Query = { query?: { [key: string]: string | string[] | undefined } };
interface TransitionOptions extends Omit<NextTransitionOptions, "locale"> {
locale?: Locale | false;
}
export type NextRouter<P extends Route["pathname"] = Route["pathname"]> =
Extract<Route, { pathname: P }> &
Omit<
Router,
| "push"
| "replace"
| "locale"
| "locales"
| "defaultLocale"
| "domainLocales"
> & {
defaultLocale: "ja";
domainLocales?: undefined;
locale: Locale;
locales: [
"en",
"ja"
];
push(
url: Route | StaticRoute | Query,
as?: string,
options?: TransitionOptions
): Promise<boolean>;
replace(
url: Route | StaticRoute | Query,
as?: string,
options?: TransitionOptions
): Promise<boolean>;
route: P;
};
export function useRouter<P extends Route["pathname"]>(): NextRouter<P>;
}