From d3095ca34d9dc3bbdc61cb688fac1fcdc35788f3 Mon Sep 17 00:00:00 2001 From: Sam Sauer Date: Thu, 18 Dec 2025 10:21:14 +0100 Subject: [PATCH] refactor(types): remove unused route and validator type definitions --- types/routes.d.ts | 82 ----------------------- types/validator.ts | 160 --------------------------------------------- 2 files changed, 242 deletions(-) delete mode 100644 types/routes.d.ts delete mode 100644 types/validator.ts diff --git a/types/routes.d.ts b/types/routes.d.ts deleted file mode 100644 index 43fce73..0000000 --- a/types/routes.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -// This file is generated automatically by Next.js -// Do not edit this file manually - -type AppRoutes = "/" | "/donate-with-checkout" | "/donate-with-checkout/result" | "/donate-with-elements" | "/donate-with-elements/result" | "/donate-with-embedded-checkout" | "/donate-with-embedded-checkout/result" -type AppRouteHandlerRoutes = "/api/webhooks" -type PageRoutes = never -type LayoutRoutes = "/" | "/donate-with-checkout/result" | "/donate-with-elements/result" | "/donate-with-embedded-checkout/result" -type RedirectRoutes = never -type RewriteRoutes = never -type Routes = AppRoutes | PageRoutes | LayoutRoutes | RedirectRoutes | RewriteRoutes | AppRouteHandlerRoutes - - -interface ParamMap { - "/": {} - "/api/webhooks": {} - "/donate-with-checkout": {} - "/donate-with-checkout/result": {} - "/donate-with-elements": {} - "/donate-with-elements/result": {} - "/donate-with-embedded-checkout": {} - "/donate-with-embedded-checkout/result": {} -} - - -export type ParamsOf = ParamMap[Route] - -interface LayoutSlotMap { - "/": never - "/donate-with-checkout/result": never - "/donate-with-elements/result": never - "/donate-with-embedded-checkout/result": never -} - - -export type { AppRoutes, PageRoutes, LayoutRoutes, RedirectRoutes, RewriteRoutes, ParamMap, AppRouteHandlerRoutes } - -declare global { - /** - * Props for Next.js App Router page components - * @example - * ```tsx - * export default function Page(props: PageProps<'/blog/[slug]'>) { - * const { slug } = await props.params - * return
Blog post: {slug}
- * } - * ``` - */ - interface PageProps { - params: Promise - searchParams: Promise> - } - - /** - * Props for Next.js App Router layout components - * @example - * ```tsx - * export default function Layout(props: LayoutProps<'/dashboard'>) { - * return
{props.children}
- * } - * ``` - */ - type LayoutProps = { - params: Promise - children: React.ReactNode - } & { - [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 { - params: Promise - } -} diff --git a/types/validator.ts b/types/validator.ts deleted file mode 100644 index 4ac70dd..0000000 --- a/types/validator.ts +++ /dev/null @@ -1,160 +0,0 @@ -// This file is generated automatically by Next.js -// Do not edit this file manually -// This file validates that all pages and layouts export the correct types - -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 = { - default: React.ComponentType<{ params: Promise } & any> | ((props: { params: Promise } & any) => React.ReactNode | Promise | never | void | Promise) - generateStaticParams?: (props: { params: ParamMap[Route] }) => Promise | any[] - generateMetadata?: ( - props: { params: Promise } & any, - parent: ResolvingMetadata - ) => Promise | any - generateViewport?: ( - props: { params: Promise } & any, - parent: ResolvingViewport - ) => Promise | any - metadata?: any - viewport?: any -} - -type LayoutConfig = { - default: React.ComponentType> | ((props: LayoutProps) => React.ReactNode | Promise | never | void | Promise) - generateStaticParams?: (props: { params: ParamMap[Route] }) => Promise | any[] - generateMetadata?: ( - props: { params: Promise } & any, - parent: ResolvingMetadata - ) => Promise | any - generateViewport?: ( - props: { params: Promise } & any, - parent: ResolvingViewport - ) => Promise | any - metadata?: any - viewport?: any -} - -type RouteHandlerConfig = { - GET?: (request: NextRequest, context: { params: Promise }) => Promise | Response | void - POST?: (request: NextRequest, context: { params: Promise }) => Promise | Response | void - PUT?: (request: NextRequest, context: { params: Promise }) => Promise | Response | void - PATCH?: (request: NextRequest, context: { params: Promise }) => Promise | Response | void - DELETE?: (request: NextRequest, context: { params: Promise }) => Promise | Response | void - HEAD?: (request: NextRequest, context: { params: Promise }) => Promise | Response | void - OPTIONS?: (request: NextRequest, context: { params: Promise }) => Promise | Response | void -} - - -// Validate ../../app/donate-with-checkout/page.tsx -{ - type __IsExpected> = Specific - const handler = {} as typeof import("../../app/donate-with-checkout/page.js") - type __Check = __IsExpected - // @ts-ignore - type __Unused = __Check -} - -// Validate ../../app/donate-with-checkout/result/page.tsx -{ - type __IsExpected> = Specific - const handler = {} as typeof import("../../app/donate-with-checkout/result/page.js") - type __Check = __IsExpected - // @ts-ignore - type __Unused = __Check -} - -// Validate ../../app/donate-with-elements/page.tsx -{ - type __IsExpected> = Specific - const handler = {} as typeof import("../../app/donate-with-elements/page.js") - type __Check = __IsExpected - // @ts-ignore - type __Unused = __Check -} - -// Validate ../../app/donate-with-elements/result/page.tsx -{ - type __IsExpected> = Specific - const handler = {} as typeof import("../../app/donate-with-elements/result/page.js") - type __Check = __IsExpected - // @ts-ignore - type __Unused = __Check -} - -// Validate ../../app/donate-with-embedded-checkout/page.tsx -{ - type __IsExpected> = Specific - const handler = {} as typeof import("../../app/donate-with-embedded-checkout/page.js") - type __Check = __IsExpected - // @ts-ignore - type __Unused = __Check -} - -// Validate ../../app/donate-with-embedded-checkout/result/page.tsx -{ - type __IsExpected> = Specific - const handler = {} as typeof import("../../app/donate-with-embedded-checkout/result/page.js") - type __Check = __IsExpected - // @ts-ignore - type __Unused = __Check -} - -// Validate ../../app/page.tsx -{ - type __IsExpected> = Specific - const handler = {} as typeof import("../../app/page.js") - type __Check = __IsExpected - // @ts-ignore - type __Unused = __Check -} - -// Validate ../../app/api/webhooks/route.ts -{ - type __IsExpected> = Specific - const handler = {} as typeof import("../../app/api/webhooks/route.js") - type __Check = __IsExpected - // @ts-ignore - type __Unused = __Check -} - - - - - -// Validate ../../app/donate-with-checkout/result/layout.tsx -{ - type __IsExpected> = Specific - const handler = {} as typeof import("../../app/donate-with-checkout/result/layout.js") - type __Check = __IsExpected - // @ts-ignore - type __Unused = __Check -} - -// Validate ../../app/donate-with-elements/result/layout.tsx -{ - type __IsExpected> = Specific - const handler = {} as typeof import("../../app/donate-with-elements/result/layout.js") - type __Check = __IsExpected - // @ts-ignore - type __Unused = __Check -} - -// Validate ../../app/donate-with-embedded-checkout/result/layout.tsx -{ - type __IsExpected> = Specific - const handler = {} as typeof import("../../app/donate-with-embedded-checkout/result/layout.js") - type __Check = __IsExpected - // @ts-ignore - type __Unused = __Check -} - -// Validate ../../app/layout.tsx -{ - type __IsExpected> = Specific - const handler = {} as typeof import("../../app/layout.js") - type __Check = __IsExpected - // @ts-ignore - type __Unused = __Check -} -- 2.51.2