0.0.1.0
This commit is contained in:
Vendored
+32
-3
@@ -1,22 +1,37 @@
|
||||
// This file is generated automatically by Next.js
|
||||
// Do not edit this file manually
|
||||
|
||||
type AppRoutes = "/" | "/members" | "/members/[id]" | "/members/new" | "/settings" | "/timeline" | "/tree"
|
||||
type AppRoutes = "/" | "/auth/register" | "/auth/signin" | "/members" | "/members/[id]" | "/members/new" | "/migrate" | "/settings" | "/timeline" | "/tree" | "/trees/new"
|
||||
type AppRouteHandlerRoutes = "/api/auth/[...nextauth]" | "/api/auth/register" | "/api/trees" | "/api/trees/[treeId]" | "/api/trees/[treeId]/activity-logs" | "/api/trees/[treeId]/import" | "/api/trees/[treeId]/members" | "/api/trees/[treeId]/members/[memberId]" | "/api/user/change-password" | "/api/user/profile"
|
||||
type PageRoutes = never
|
||||
type LayoutRoutes = "/"
|
||||
type RedirectRoutes = never
|
||||
type RewriteRoutes = never
|
||||
type Routes = AppRoutes | PageRoutes | LayoutRoutes | RedirectRoutes | RewriteRoutes
|
||||
type Routes = AppRoutes | PageRoutes | LayoutRoutes | RedirectRoutes | RewriteRoutes | AppRouteHandlerRoutes
|
||||
|
||||
|
||||
interface ParamMap {
|
||||
"/": {}
|
||||
"/api/auth/[...nextauth]": { "nextauth": string[]; }
|
||||
"/api/auth/register": {}
|
||||
"/api/trees": {}
|
||||
"/api/trees/[treeId]": { "treeId": string; }
|
||||
"/api/trees/[treeId]/activity-logs": { "treeId": string; }
|
||||
"/api/trees/[treeId]/import": { "treeId": string; }
|
||||
"/api/trees/[treeId]/members": { "treeId": string; }
|
||||
"/api/trees/[treeId]/members/[memberId]": { "treeId": string; "memberId": string; }
|
||||
"/api/user/change-password": {}
|
||||
"/api/user/profile": {}
|
||||
"/auth/register": {}
|
||||
"/auth/signin": {}
|
||||
"/members": {}
|
||||
"/members/[id]": { "id": string; }
|
||||
"/members/new": {}
|
||||
"/migrate": {}
|
||||
"/settings": {}
|
||||
"/timeline": {}
|
||||
"/tree": {}
|
||||
"/trees/new": {}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +42,7 @@ interface LayoutSlotMap {
|
||||
}
|
||||
|
||||
|
||||
export type { AppRoutes, PageRoutes, LayoutRoutes, RedirectRoutes, RewriteRoutes, ParamMap }
|
||||
export type { AppRoutes, PageRoutes, LayoutRoutes, RedirectRoutes, RewriteRoutes, ParamMap, AppRouteHandlerRoutes }
|
||||
|
||||
declare global {
|
||||
/**
|
||||
@@ -60,4 +75,18 @@ declare global {
|
||||
} & {
|
||||
[K in LayoutSlotMap[LayoutRoute]]: React.ReactNode
|
||||
}
|
||||
|
||||
/**
|
||||
* Context for Next.js App Router route handlers
|
||||
* @example
|
||||
* ```tsx
|
||||
* export async function GET(request: NextRequest, context: RouteContext<'/api/users/[id]'>) {
|
||||
* const { id } = await context.params
|
||||
* return Response.json({ id })
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
interface RouteContext<AppRouteHandlerRoute extends AppRouteHandlerRoutes> {
|
||||
params: Promise<ParamMap[AppRouteHandlerRoute]>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
// Do not edit this file manually
|
||||
// This file validates that all pages and layouts export the correct types
|
||||
|
||||
import type { AppRoutes, LayoutRoutes, ParamMap } from "./routes.js"
|
||||
import type { AppRoutes, LayoutRoutes, ParamMap, AppRouteHandlerRoutes } from "./routes.js"
|
||||
import type { ResolvingMetadata, ResolvingViewport } from "next/types.js"
|
||||
import type { NextRequest } from 'next/server.js'
|
||||
|
||||
type AppPageConfig<Route extends AppRoutes = AppRoutes> = {
|
||||
default: React.ComponentType<{ params: Promise<ParamMap[Route]> } & any> | ((props: { params: Promise<ParamMap[Route]> } & any) => React.ReactNode | Promise<React.ReactNode> | never | void | Promise<void>)
|
||||
@@ -35,6 +36,34 @@ type LayoutConfig<Route extends LayoutRoutes = LayoutRoutes> = {
|
||||
viewport?: any
|
||||
}
|
||||
|
||||
type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRoutes> = {
|
||||
GET?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void
|
||||
POST?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void
|
||||
PUT?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void
|
||||
PATCH?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void
|
||||
DELETE?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void
|
||||
HEAD?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void
|
||||
OPTIONS?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void
|
||||
}
|
||||
|
||||
|
||||
// Validate ../../../app/auth/register/page.tsx
|
||||
{
|
||||
type __IsExpected<Specific extends AppPageConfig<"/auth/register">> = Specific
|
||||
const handler = {} as typeof import("../../../app/auth/register/page.js")
|
||||
type __Check = __IsExpected<typeof handler>
|
||||
// @ts-ignore
|
||||
type __Unused = __Check
|
||||
}
|
||||
|
||||
// Validate ../../../app/auth/signin/page.tsx
|
||||
{
|
||||
type __IsExpected<Specific extends AppPageConfig<"/auth/signin">> = Specific
|
||||
const handler = {} as typeof import("../../../app/auth/signin/page.js")
|
||||
type __Check = __IsExpected<typeof handler>
|
||||
// @ts-ignore
|
||||
type __Unused = __Check
|
||||
}
|
||||
|
||||
// Validate ../../../app/members/[id]/page.tsx
|
||||
{
|
||||
@@ -63,6 +92,15 @@ type LayoutConfig<Route extends LayoutRoutes = LayoutRoutes> = {
|
||||
type __Unused = __Check
|
||||
}
|
||||
|
||||
// Validate ../../../app/migrate/page.tsx
|
||||
{
|
||||
type __IsExpected<Specific extends AppPageConfig<"/migrate">> = Specific
|
||||
const handler = {} as typeof import("../../../app/migrate/page.js")
|
||||
type __Check = __IsExpected<typeof handler>
|
||||
// @ts-ignore
|
||||
type __Unused = __Check
|
||||
}
|
||||
|
||||
// Validate ../../../app/page.tsx
|
||||
{
|
||||
type __IsExpected<Specific extends AppPageConfig<"/">> = Specific
|
||||
@@ -99,7 +137,104 @@ type LayoutConfig<Route extends LayoutRoutes = LayoutRoutes> = {
|
||||
type __Unused = __Check
|
||||
}
|
||||
|
||||
// Validate ../../../app/trees/new/page.tsx
|
||||
{
|
||||
type __IsExpected<Specific extends AppPageConfig<"/trees/new">> = Specific
|
||||
const handler = {} as typeof import("../../../app/trees/new/page.js")
|
||||
type __Check = __IsExpected<typeof handler>
|
||||
// @ts-ignore
|
||||
type __Unused = __Check
|
||||
}
|
||||
|
||||
// Validate ../../../app/api/auth/[...nextauth]/route.ts
|
||||
{
|
||||
type __IsExpected<Specific extends RouteHandlerConfig<"/api/auth/[...nextauth]">> = Specific
|
||||
const handler = {} as typeof import("../../../app/api/auth/[...nextauth]/route.js")
|
||||
type __Check = __IsExpected<typeof handler>
|
||||
// @ts-ignore
|
||||
type __Unused = __Check
|
||||
}
|
||||
|
||||
// Validate ../../../app/api/auth/register/route.ts
|
||||
{
|
||||
type __IsExpected<Specific extends RouteHandlerConfig<"/api/auth/register">> = Specific
|
||||
const handler = {} as typeof import("../../../app/api/auth/register/route.js")
|
||||
type __Check = __IsExpected<typeof handler>
|
||||
// @ts-ignore
|
||||
type __Unused = __Check
|
||||
}
|
||||
|
||||
// Validate ../../../app/api/trees/[treeId]/activity-logs/route.ts
|
||||
{
|
||||
type __IsExpected<Specific extends RouteHandlerConfig<"/api/trees/[treeId]/activity-logs">> = Specific
|
||||
const handler = {} as typeof import("../../../app/api/trees/[treeId]/activity-logs/route.js")
|
||||
type __Check = __IsExpected<typeof handler>
|
||||
// @ts-ignore
|
||||
type __Unused = __Check
|
||||
}
|
||||
|
||||
// Validate ../../../app/api/trees/[treeId]/import/route.ts
|
||||
{
|
||||
type __IsExpected<Specific extends RouteHandlerConfig<"/api/trees/[treeId]/import">> = Specific
|
||||
const handler = {} as typeof import("../../../app/api/trees/[treeId]/import/route.js")
|
||||
type __Check = __IsExpected<typeof handler>
|
||||
// @ts-ignore
|
||||
type __Unused = __Check
|
||||
}
|
||||
|
||||
// Validate ../../../app/api/trees/[treeId]/members/[memberId]/route.ts
|
||||
{
|
||||
type __IsExpected<Specific extends RouteHandlerConfig<"/api/trees/[treeId]/members/[memberId]">> = Specific
|
||||
const handler = {} as typeof import("../../../app/api/trees/[treeId]/members/[memberId]/route.js")
|
||||
type __Check = __IsExpected<typeof handler>
|
||||
// @ts-ignore
|
||||
type __Unused = __Check
|
||||
}
|
||||
|
||||
// Validate ../../../app/api/trees/[treeId]/members/route.ts
|
||||
{
|
||||
type __IsExpected<Specific extends RouteHandlerConfig<"/api/trees/[treeId]/members">> = Specific
|
||||
const handler = {} as typeof import("../../../app/api/trees/[treeId]/members/route.js")
|
||||
type __Check = __IsExpected<typeof handler>
|
||||
// @ts-ignore
|
||||
type __Unused = __Check
|
||||
}
|
||||
|
||||
// Validate ../../../app/api/trees/[treeId]/route.ts
|
||||
{
|
||||
type __IsExpected<Specific extends RouteHandlerConfig<"/api/trees/[treeId]">> = Specific
|
||||
const handler = {} as typeof import("../../../app/api/trees/[treeId]/route.js")
|
||||
type __Check = __IsExpected<typeof handler>
|
||||
// @ts-ignore
|
||||
type __Unused = __Check
|
||||
}
|
||||
|
||||
// Validate ../../../app/api/trees/route.ts
|
||||
{
|
||||
type __IsExpected<Specific extends RouteHandlerConfig<"/api/trees">> = Specific
|
||||
const handler = {} as typeof import("../../../app/api/trees/route.js")
|
||||
type __Check = __IsExpected<typeof handler>
|
||||
// @ts-ignore
|
||||
type __Unused = __Check
|
||||
}
|
||||
|
||||
// Validate ../../../app/api/user/change-password/route.ts
|
||||
{
|
||||
type __IsExpected<Specific extends RouteHandlerConfig<"/api/user/change-password">> = Specific
|
||||
const handler = {} as typeof import("../../../app/api/user/change-password/route.js")
|
||||
type __Check = __IsExpected<typeof handler>
|
||||
// @ts-ignore
|
||||
type __Unused = __Check
|
||||
}
|
||||
|
||||
// Validate ../../../app/api/user/profile/route.ts
|
||||
{
|
||||
type __IsExpected<Specific extends RouteHandlerConfig<"/api/user/profile">> = Specific
|
||||
const handler = {} as typeof import("../../../app/api/user/profile/route.js")
|
||||
type __Check = __IsExpected<typeof handler>
|
||||
// @ts-ignore
|
||||
type __Unused = __Check
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user