|
| 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( |
| 11 | + err: Error, |
| 12 | + req: any, |
| 13 | + res: any, |
| 14 | + pathname: string, |
| 15 | + query: any |
| 16 | + ): string, |
| 17 | + }; |
| 18 | + declare module.exports: (...opts: any) => NextApp; |
| 19 | +} |
| 20 | + |
| 21 | +declare module 'next/head' { |
| 22 | + declare module.exports: Class<React$Component<any, any>>; |
| 23 | +} |
| 24 | + |
| 25 | +declare module 'next/link' { |
| 26 | + declare module.exports: Class< |
| 27 | + React$Component<{ href: string, prefetch?: boolean }, any> |
| 28 | + >; |
| 29 | +} |
| 30 | + |
| 31 | +declare module 'next/error' { |
| 32 | + declare module.exports: Class<React$Component<{ statusCode: number }, any>>; |
| 33 | +} |
| 34 | + |
| 35 | +declare module 'next/router' { |
| 36 | + declare module.exports: { |
| 37 | + route: string, |
| 38 | + pathname: string, |
| 39 | + query: Object, |
| 40 | + onRouteChangeStart: ?(url: string) => void, |
| 41 | + onRouteChangeComplete: ?(url: string) => void, |
| 42 | + onRouteChangeError: ?( |
| 43 | + err: Error & { cancelled: boolean }, |
| 44 | + url: string |
| 45 | + ) => void, |
| 46 | + push(url: string, as: ?string): Promise<boolean>, |
| 47 | + replace(url: string, as: ?string): Promise<boolean>, |
| 48 | + }; |
| 49 | +} |
| 50 | + |
| 51 | +declare module 'next/document' { |
| 52 | + declare export var Head: Class<React$Component<any, any>>; |
| 53 | + declare export var Main: Class<React$Component<any, any>>; |
| 54 | + declare export var NextScript: Class<React$Component<any, any>>; |
| 55 | + declare export default Class<React$Component<any, any>> & { |
| 56 | + getInitialProps: (ctx: { |
| 57 | + pathname: string, |
| 58 | + query: any, |
| 59 | + req?: any, |
| 60 | + res?: any, |
| 61 | + jsonPageRes?: any, |
| 62 | + err?: any, |
| 63 | + }) => Promise<any>, |
| 64 | + renderPage(cb: Function): void, |
| 65 | + }; |
| 66 | +} |
0 commit comments