Open History to see the last commit
1import type { Register } from './router'
2import type {
3 AnyContext,
4 AnyPathParams,
5 AnyRoute,
6 FileBaseRouteOptions,
7 ResolveParams,
8 Route,
9 RouteConstraints,
10 UpdatableRouteOptions,
11} from './route'
12import type { AnyValidator } from './validators'
13β
14export interface FileRouteTypes {
15 fileRoutesByFullPath: any
16 fullPaths: any
17 to: any
18 fileRoutesByTo: any
19 id: any
20 fileRoutesById: any
21}
22β
23export type InferFileRouteTypes<TRouteTree extends AnyRoute> =
24 unknown extends TRouteTree['types']['fileRouteTypes']
25 ? never
26 : TRouteTree['types']['fileRouteTypes'] extends FileRouteTypes
27 ? TRouteTree['types']['fileRouteTypes']
28 : never
29β
30export interface FileRoutesByPath {
31 // '/': {
32 // parentRoute: typeof rootRoute
33 // }
34}
35β
36export interface FileRouteOptions<
37 TRegister,
38 TFilePath extends string,
39 TParentRoute extends AnyRoute,
40 TId extends RouteConstraints['TId'],
41 TPath extends RouteConstraints['TPath'],
42 TFullPath extends RouteConstraints['TFullPath'],
43 TSearchValidator = undefined,
44 TParams = ResolveParams<TPath>,
45 TRouteContextFn = AnyContext,
46 TBeforeLoadFn = AnyContext,
47 TLoaderDeps extends Record<string, any> = {},
48 TLoaderFn = undefined,
49 TSSR = unknown,
50 TServerMiddlewares = unknown,
51 THandlers = undefined,
52>
53 extends
54 FileBaseRouteOptions<
55 TRegister,
56 TParentRoute,
57 TId,
58 TPath,
59 TSearchValidator,
60 TParams,
61 TLoaderDeps,
62 TLoaderFn,
63 AnyContext,
64 TRouteContextFn,
65 TBeforeLoadFn,
66 AnyContext,
67 TSSR,
68 TServerMiddlewares,
69 THandlers
70 >,
71 UpdatableRouteOptions<
72 TParentRoute,
73 TId,
74 TFullPath,
75 TParams,
76 TSearchValidator,
77 TLoaderFn,
78 TLoaderDeps,
79 AnyContext,
80 TRouteContextFn,
81 TBeforeLoadFn
82 > {}
83β
84export type CreateFileRoute<
85 TFilePath extends string,
86 TParentRoute extends AnyRoute,
87 TId extends RouteConstraints['TId'],
88 TPath extends RouteConstraints['TPath'],
89 TFullPath extends RouteConstraints['TFullPath'],
90> = <
91 TRegister = Register,
92 TSearchValidator = undefined,
93 TParams = ResolveParams<TPath>,
94 TRouteContextFn = AnyContext,
95 TBeforeLoadFn = AnyContext,
96 TLoaderDeps extends Record<string, any> = {},
97 TLoaderFn = undefined,
98 TSSR = unknown,
99 TServerMiddlewares = unknown,
100 THandlers = undefined,
101>(
102 options?: FileRouteOptions<
103 TRegister,
104 TFilePath,
105 TParentRoute,
106 TId,
107 TPath,
108 TFullPath,
109 TSearchValidator,
110 TParams,
111 TRouteContextFn,
112 TBeforeLoadFn,
113 TLoaderDeps,
114 TLoaderFn,
115 TSSR,
116 TServerMiddlewares,
117 THandlers
118 >,
119) => Route<
120 TRegister,
121 TParentRoute,
122 TPath,
123 TFullPath,
124 TFilePath,
125 TId,
126 TSearchValidator,
127 TParams,
128 AnyContext,
129 TRouteContextFn,
130 TBeforeLoadFn,
131 TLoaderDeps,
132 TLoaderFn,
133 unknown,
134 unknown,
135 TSSR,
136 TServerMiddlewares,
137 THandlers
138>
139β
140export type LazyRouteOptions = Pick<
141 UpdatableRouteOptions<
142 AnyRoute,
143 string,
144 string,
145 AnyPathParams,
146 AnyValidator,
147 {},
148 AnyContext,
149 AnyContext,
150 AnyContext,
151 AnyContext
152 >,
153 'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent'
154>
155β
156export interface LazyRoute<in out TRoute extends AnyRoute> {
157 options: {
158 id: string
159 } & LazyRouteOptions
160}
161β
162export type CreateLazyFileRoute<TRoute extends AnyRoute> = (
163 opts: LazyRouteOptions,
164) => LazyRoute<TRoute>