import { IncomingMessage, ServerResponse } from "http"; import { Server } from "next"; import { ComponentType } from "react"; import { LinkState } from "next/link"; import { SingletonRouter, EventChangeOptions } from "next/router"; export type HTTPHandler = ( request: IncomingMessage, response: ServerResponse ) => void; export type RouteParams = { [k: string]: string | number; }; export interface LinkProps extends LinkState { route: string; params?: RouteParams; } export interface Router extends SingletonRouter { pushRoute( route: string, params?: RouteParams, options?: EventChangeOptions ): Promise; replaceRoute( route: string, params?: RouteParams, options?: EventChangeOptions ): Promise; prefetchRoute( route: string, params?: RouteParams ): Promise>; } export interface Registry { getRequestHandler(app: Server, custom?: HTTPHandler): HTTPHandler; add(name: string, pattern?: string, page?: string): this; add(pattern: string, page: string): this; add(options: { name: string; pattern?: string; page?: string }): this; Link: ComponentType; Router: Router; } export default class Routes implements Registry { getRequestHandler(app: Server, custom?: HTTPHandler): HTTPHandler; add(name: string, pattern?: string, page?: string): this; add(pattern: string, page: string): this; add(options: { name: string; pattern?: string; page?: string }): this; Link: ComponentType; Router: Router; }