// File: /workspace/src/app/api/payment/route.ts import * as entry from '../../../../../src/app/api/payment/route.js' import type { NextRequest } from 'next/server.js' type TEntry = typeof import('../../../../../src/app/api/payment/route.js') // Check that the entry is a valid entry checkFields | false dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static' dynamicParams?: boolean fetchCache?: 'auto' | 'force-no-store' | 'only-no-store' | 'default-no-store' | 'default-cache' | 'only-cache' | 'force-cache' preferredRegion?: 'auto' | 'global' | 'home' | string | string[] runtime?: 'nodejs' | 'experimental-edge' | 'edge' maxDuration?: number }, TEntry, ''>>() // Check the prop type of the entry function if ('GET' in entry) { checkFields< Diff< ParamCheck, { __tag__: 'GET' __param_position__: 'first' __param_type__: FirstArg> }, 'GET' > >() checkFields< Diff< ParamCheck, { __tag__: 'GET' __param_position__: 'second' __param_type__: SecondArg> }, 'GET' > >() checkFields< Diff< { __tag__: 'GET', __return_type__: Response | void | never | Promise }, { __tag__: 'GET', __return_type__: ReturnType> }, 'GET' > >() } // Check the prop type of the entry function if ('HEAD' in entry) { checkFields< Diff< ParamCheck, { __tag__: 'HEAD' __param_position__: 'first' __param_type__: FirstArg> }, 'HEAD' > >() checkFields< Diff< ParamCheck, { __tag__: 'HEAD' __param_position__: 'second' __param_type__: SecondArg> }, 'HEAD' > >() checkFields< Diff< { __tag__: 'HEAD', __return_type__: Response | void | never | Promise }, { __tag__: 'HEAD', __return_type__: ReturnType> }, 'HEAD' > >() } // Check the prop type of the entry function if ('OPTIONS' in entry) { checkFields< Diff< ParamCheck, { __tag__: 'OPTIONS' __param_position__: 'first' __param_type__: FirstArg> }, 'OPTIONS' > >() checkFields< Diff< ParamCheck, { __tag__: 'OPTIONS' __param_position__: 'second' __param_type__: SecondArg> }, 'OPTIONS' > >() checkFields< Diff< { __tag__: 'OPTIONS', __return_type__: Response | void | never | Promise }, { __tag__: 'OPTIONS', __return_type__: ReturnType> }, 'OPTIONS' > >() } // Check the prop type of the entry function if ('POST' in entry) { checkFields< Diff< ParamCheck, { __tag__: 'POST' __param_position__: 'first' __param_type__: FirstArg> }, 'POST' > >() checkFields< Diff< ParamCheck, { __tag__: 'POST' __param_position__: 'second' __param_type__: SecondArg> }, 'POST' > >() checkFields< Diff< { __tag__: 'POST', __return_type__: Response | void | never | Promise }, { __tag__: 'POST', __return_type__: ReturnType> }, 'POST' > >() } // Check the prop type of the entry function if ('PUT' in entry) { checkFields< Diff< ParamCheck, { __tag__: 'PUT' __param_position__: 'first' __param_type__: FirstArg> }, 'PUT' > >() checkFields< Diff< ParamCheck, { __tag__: 'PUT' __param_position__: 'second' __param_type__: SecondArg> }, 'PUT' > >() checkFields< Diff< { __tag__: 'PUT', __return_type__: Response | void | never | Promise }, { __tag__: 'PUT', __return_type__: ReturnType> }, 'PUT' > >() } // Check the prop type of the entry function if ('DELETE' in entry) { checkFields< Diff< ParamCheck, { __tag__: 'DELETE' __param_position__: 'first' __param_type__: FirstArg> }, 'DELETE' > >() checkFields< Diff< ParamCheck, { __tag__: 'DELETE' __param_position__: 'second' __param_type__: SecondArg> }, 'DELETE' > >() checkFields< Diff< { __tag__: 'DELETE', __return_type__: Response | void | never | Promise }, { __tag__: 'DELETE', __return_type__: ReturnType> }, 'DELETE' > >() } // Check the prop type of the entry function if ('PATCH' in entry) { checkFields< Diff< ParamCheck, { __tag__: 'PATCH' __param_position__: 'first' __param_type__: FirstArg> }, 'PATCH' > >() checkFields< Diff< ParamCheck, { __tag__: 'PATCH' __param_position__: 'second' __param_type__: SecondArg> }, 'PATCH' > >() checkFields< Diff< { __tag__: 'PATCH', __return_type__: Response | void | never | Promise }, { __tag__: 'PATCH', __return_type__: ReturnType> }, 'PATCH' > >() } // Check the arguments and return type of the generateStaticParams function if ('generateStaticParams' in entry) { checkFields>, 'generateStaticParams'>>() checkFields }, { __tag__: 'generateStaticParams', __return_type__: ReturnType> }>>() } type PageParams = any export interface PageProps { params?: any searchParams?: any } export interface LayoutProps { children?: React.ReactNode params?: any } // ============= // Utility types type RevalidateRange = T extends { revalidate: any } ? NonNegative : never // If T is unknown or any, it will be an empty {} type. Otherwise, it will be the same as Omit. type OmitWithTag = Omit type Diff = 0 extends (1 & T) ? {} : OmitWithTag type FirstArg = T extends (...args: [infer T, any]) => any ? unknown extends T ? any : T : never type SecondArg = T extends (...args: [any, infer T]) => any ? unknown extends T ? any : T : never type MaybeField = T extends { [k in K]: infer G } ? G extends Function ? G : never : never type ParamCheck = { __tag__: string __param_position__: string __param_type__: T } function checkFields<_ extends { [k in keyof any]: never }>() {} // https://github.com/sindresorhus/type-fest type Numeric = number | bigint type Zero = 0 | 0n type Negative = T extends Zero ? never : `${T}` extends `-${string}` ? T : never type NonNegative = T extends Zero ? T : Negative extends never ? T : '__invalid_negative_number__'