|
| 1 | +/* @flow */ |
| 2 | + |
| 3 | +declare module "next" { |
| 4 | + declare type NextApp = { |
| 5 | + prepare(): Promise<void>; |
| 6 | + getRequestHandler(): any; |
| 7 | + render(req: any, res: any, pathname: string, query: any): any; |
| 8 | + renderToHTML(req: any, res: any, pathname: string, query: string): string; |
| 9 | + renderError(err: Error, req: any, res: any, pathname: any, query: any): any; |
| 10 | + renderErrorToHTML(err: Error, req: any, res: any, pathname: string, query: any): string; |
| 11 | + }; |
| 12 | + declare module.exports: (...opts: any) => NextApp |
| 13 | +} |
| 14 | + |
| 15 | +declare module "next/head" { |
| 16 | + declare module.exports: Class<React$Component<void, any, any>>; |
| 17 | +} |
| 18 | + |
| 19 | +declare module "next/link" { |
| 20 | + declare module.exports: Class<React$Component<void, {href: string}, any>>; |
| 21 | +} |
| 22 | + |
| 23 | +declare module "next/prefetch" { |
| 24 | + declare export var prefetch: (url: string) => any; |
| 25 | + declare export var reloadIfPrefetched: any; |
| 26 | + declare export default Class<React$Component<void, {href: string, prefetch?: boolean}, any>>; |
| 27 | +} |
| 28 | + |
| 29 | +declare module "next/router" { |
| 30 | + declare module.exports: { |
| 31 | + route: string; |
| 32 | + pathname: string; |
| 33 | + query: Object; |
| 34 | + onRouteChangeStart: ?((url: string) => void); |
| 35 | + onRouteChangeComplete: ?((url: string) => void); |
| 36 | + onRouteChangeError: ?((err: Error & {cancelled: boolean}, url: string) => void); |
| 37 | + push(url: string, as: ?string): Promise<boolean>; |
| 38 | + replace(url: string, as: ?string): Promise<boolean>; |
| 39 | + }; |
| 40 | +} |
| 41 | + |
| 42 | +declare module "next/document" { |
| 43 | + declare export var Head: Class<React$Component<void, any, any>>; |
| 44 | + declare export var Main: Class<React$Component<void, any, any>>; |
| 45 | + declare export var NextScript: Class<React$Component<void, any, any>>; |
| 46 | + declare export default Class<React$Component<void, any, any>> & { |
| 47 | + getInitialProps: (ctx: {pathname: string, query: any, req?: any, res?: any, xhr?: any, err?: any}) => Promise<any>; |
| 48 | + renderPage(cb: Function): void; |
| 49 | + }; |
| 50 | +} |
0 commit comments