1 |
|
2 |
|
3 |
|
4 |
|
5 | import React from 'react'
|
6 | import { ParsedUrlQuery } from 'querystring'
|
7 | import { IncomingMessage, ServerResponse } from 'http'
|
8 |
|
9 | import {
|
10 | NextPageContext,
|
11 | NextComponentType,
|
12 | NextApiResponse,
|
13 | NextApiRequest,
|
14 | NextApiHandler,
|
15 |
|
16 | } from '../dist/next-server/lib/utils'
|
17 |
|
18 |
|
19 | import next from '../dist/server/next'
|
20 |
|
21 |
|
22 | declare module 'react' {
|
23 |
|
24 | interface HtmlHTMLAttributes<T> extends React.HTMLAttributes<T> {
|
25 | amp?: string
|
26 | }
|
27 |
|
28 |
|
29 | interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
|
30 | nonce?: string
|
31 | }
|
32 |
|
33 |
|
34 | interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
|
35 | jsx?: boolean
|
36 | global?: boolean
|
37 | }
|
38 | }
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | export type NextPage<P = {}, IP = P> = NextComponentType<NextPageContext, IP, P>
|
44 |
|
45 |
|
46 |
|
47 |
|
48 | export type PageConfig = {
|
49 | amp?: boolean | 'hybrid'
|
50 | api?: {
|
51 | |
52 |
|
53 |
|
54 |
|
55 | bodyParser?: { sizeLimit?: number | string } | false
|
56 | }
|
57 | }
|
58 |
|
59 | export {
|
60 | NextPageContext,
|
61 | NextComponentType,
|
62 | NextApiResponse,
|
63 | NextApiRequest,
|
64 | NextApiHandler,
|
65 | }
|
66 |
|
67 | export type GetStaticProps = (ctx: {
|
68 | params?: ParsedUrlQuery
|
69 | preview?: boolean
|
70 | previewData?: any
|
71 | }) => Promise<{
|
72 | props: { [key: string]: any }
|
73 | revalidate?: number | boolean
|
74 | }>
|
75 |
|
76 | export type GetStaticPaths = () => Promise<{
|
77 | paths: Array<string | { params: ParsedUrlQuery }>
|
78 | fallback: boolean
|
79 | }>
|
80 |
|
81 | export type GetServerSideProps = (context: {
|
82 | req: IncomingMessage
|
83 | res: ServerResponse
|
84 | params?: ParsedUrlQuery
|
85 | query: ParsedUrlQuery
|
86 | preview?: boolean
|
87 | previewData?: any
|
88 | }) => Promise<{ [key: string]: any }>
|
89 |
|
90 | export default next
|