= ComponentType & {
getInitialProps?(context: C): IP | Promise;
};
export declare type DocumentType = NextComponentType;
export declare type AppType = NextComponentType;
export declare type Enhancer = (Component: C) => C;
export declare type ComponentsEnhancer = {
enhanceApp?: Enhancer;
enhanceComponent?: Enhancer;
} | Enhancer;
export declare type RenderPageResult = {
html: string;
head?: Array;
dataOnly?: true;
};
export declare type RenderPage = (options?: ComponentsEnhancer) => RenderPageResult | Promise;
export declare type BaseContext = {
res?: ServerResponse;
[k: string]: any;
};
export declare type NEXT_DATA = {
dataManager: string;
props: any;
page: string;
query: ParsedUrlQuery;
buildId: string;
assetPrefix?: string;
runtimeConfig?: {
[key: string]: any;
};
nextExport?: boolean;
skeleton?: boolean;
dynamicIds?: string[];
err?: Error & {
statusCode?: number;
};
};
/**
* `Next` context
*/
export interface NextPageContext {
/**
* Error object if encountered during rendering
*/
err?: Error & {
statusCode?: number;
} | null;
/**
* `HTTP` request object.
*/
req?: IncomingMessage;
/**
* `HTTP` response object.
*/
res?: ServerResponse;
/**
* Path section of `URL`.
*/
pathname: string;
/**
* Query string section of `URL` parsed as an object.
*/
query: ParsedUrlQuery;
/**
* `String` of the actual path including query.
*/
asPath?: string;
/**
* `Component` the tree of the App to use if needing to render separately
*/
AppTree: AppType;
}
export declare type AppContextType = {
Component: NextComponentType;
AppTree: AppType;
ctx: NextPageContext;
router: R;
};
export declare type AppInitialProps = {
pageProps: any;
};
export declare type AppPropsType = AppInitialProps & {
Component: NextComponentType;
router: R;
};
export declare type DocumentContext = NextPageContext & {
renderPage: RenderPage;
};
export declare type DocumentInitialProps = RenderPageResult & {
styles?: React.ReactElement[] | React.ReactFragment;
};
export declare type DocumentProps = DocumentInitialProps & {
__NEXT_DATA__: NEXT_DATA;
dangerousAsPath: string;
ampPath: string;
inAmpMode: boolean;
hybridAmp: boolean;
staticMarkup: boolean;
devFiles: string[];
files: string[];
dynamicImports: ManifestItem[];
assetPrefix?: string;
canonicalBase: string;
};
/**
* Next `API` route request
*/
export declare type NextApiRequest = IncomingMessage & {
/**
* Object of `query` values from url
*/
query: {
[key: string]: string | string[];
};
/**
* Object of `cookies` from header
*/
cookies: {
[key: string]: string;
};
body: any;
};
/**
* Send body of response
*/
declare type Send = (body: T) => void;
/**
* Next `API` route response
*/
export declare type NextApiResponse = ServerResponse & {
/**
* Send data `any` data in response
*/
send: Send;
/**
* Send data `json` data in response
*/
json: Send;
status: (statusCode: number) => NextApiResponse;
};
/**
* Utils
*/
export declare function execOnce(this: any, fn: (...args: any) => any): (...args: any) => void;
export declare function getLocationOrigin(): string;
export declare function getURL(): string;
export declare function getDisplayName(Component: ComponentType): string;
export declare function isResSent(res: ServerResponse): boolean;
export declare function loadGetInitialProps(Component: NextComponentType, ctx: C): Promise;
export declare const urlObjectKeys: string[];
export declare function formatWithValidation(url: UrlObject, options?: URLFormatOptions): string;
export declare const SUPPORTS_PERFORMANCE: boolean;
export declare const SUPPORTS_PERFORMANCE_USER_TIMING: boolean;
export {};