Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
b9638631
Commit
b9638631
authored
Apr 26, 2019
by
Luis Fernando Alvarez D
Committed by
Tim Neutkens
Apr 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prefer type over interface (#7164)
parent
5aba5e62
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
82 additions
and
84 deletions
+82
-84
router.ts
packages/next-server/lib/router/router.ts
+5
-5
utils.ts
packages/next-server/lib/utils.ts
+21
-21
render.tsx
packages/next-server/server/render.tsx
+4
-4
router.ts
packages/next/client/router.ts
+24
-26
with-router.tsx
packages/next/client/with-router.tsx
+2
-2
_app.tsx
packages/next/pages/_app.tsx
+5
-5
_document.tsx
packages/next/pages/_document.tsx
+18
-18
_error.tsx
packages/next/pages/_error.tsx
+3
-3
No files found.
packages/next-server/lib/router/router.ts
View file @
b9638631
...
...
@@ -3,18 +3,18 @@
import
{
ComponentType
}
from
'react'
;
import
{
parse
}
from
'url'
;
import
mitt
,
{
MittEmitter
}
from
'../mitt'
;
import
{
formatWithValidation
,
getURL
,
loadGetInitialProps
,
IContext
,
IAppContext
}
from
'../utils'
;
import
{
formatWithValidation
,
getURL
,
loadGetInitialProps
,
IContext
,
AppContextType
}
from
'../utils'
;
import
{
rewriteUrlForNextExport
}
from
'./rewrite-url-for-export'
function
toRoute
(
path
:
string
):
string
{
return
path
.
replace
(
/
\/
$/
,
''
)
||
'/'
}
export
interface
IRouterInterface
{
export
type
BaseRouter
=
{
route
:
string
pathname
:
string
query
:
string
asPath
:
string
asPath
:
string
,
}
type
RouteInfo
=
{
...
...
@@ -28,7 +28,7 @@ type Subscription = (data: {App?: ComponentType} & RouteInfo) => void
type
BeforePopStateCallback
=
(
state
:
any
)
=>
boolean
export
default
class
Router
implements
IRouterInterface
{
export
default
class
Router
implements
BaseRouter
{
route
:
string
pathname
:
string
query
:
string
...
...
@@ -460,7 +460,7 @@ export default class Router implements IRouterInterface {
this
.
componentLoadCancel
=
cancel
const
{
Component
:
App
}
=
this
.
components
[
'/_app'
]
const
props
=
await
loadGetInitialProps
<
IAppContext
<
Router
>>
(
App
,
{
Component
,
router
:
this
,
ctx
})
const
props
=
await
loadGetInitialProps
<
AppContextType
<
Router
>>
(
App
,
{
Component
,
router
:
this
,
ctx
})
if
(
cancel
===
this
.
componentLoadCancel
)
{
this
.
componentLoadCancel
=
null
...
...
packages/next-server/lib/utils.ts
View file @
b9638631
...
...
@@ -3,18 +3,18 @@ import { ServerResponse, IncomingMessage } from 'http';
import
{
ComponentType
}
from
'react'
import
{
ParsedUrlQuery
}
from
'querystring'
import
{
ManifestItem
}
from
'../server/get-dynamic-import-bundles'
import
{
IRouterInterface
}
from
'./router/router'
import
{
BaseRouter
}
from
'./router/router'
/**
* Types used by both next and next-server
*/
export
type
NextComponentType
<
C
extends
I
BaseContext
=
any
,
P
=
any
,
CP
=
{}
>
=
ComponentType
<
CP
>
&
{
export
type
NextComponentType
<
C
extends
BaseContext
=
any
,
P
=
any
,
CP
=
{}
>
=
ComponentType
<
CP
>
&
{
getInitialProps
?(
context
:
C
):
Promise
<
P
>
,
}
export
type
DocumentType
=
NextComponentType
<
IDocumentContext
,
IDocumentInitialProps
,
I
DocumentProps
>
export
type
DocumentType
=
NextComponentType
<
DocumentContext
,
DocumentInitialProps
,
DocumentProps
>
export
type
AppType
=
NextComponentType
<
IAppContext
,
IAppInitialProps
,
IAppProps
>
export
type
AppType
=
NextComponentType
<
AppContextType
,
AppInitialProps
,
AppPropsType
>
export
type
Enhancer
<
C
>
=
(
Component
:
C
)
=>
C
...
...
@@ -26,12 +26,12 @@ export type RenderPageResult = { html: string, head?: Array<JSX.Element | null>,
export
type
RenderPage
=
(
options
?:
ComponentsEnhancer
)
=>
RenderPageResult
|
Promise
<
RenderPageResult
>
export
interface
IBaseContext
{
export
type
BaseContext
=
{
res
?:
ServerResponse
[
k
:
string
]:
any
[
k
:
string
]:
any
,
}
export
interface
INEXTDATA
{
export
type
INEXTDATA
=
{
dataManager
:
string
props
:
any
page
:
string
...
...
@@ -42,7 +42,7 @@ export interface INEXTDATA {
runtimeConfig
?:
{
[
key
:
string
]:
any
}
nextExport
?:
boolean
dynamicIds
?:
string
[]
err
?:
Error
&
{
statusCode
?:
number
}
err
?:
Error
&
{
statusCode
?:
number
}
,
}
export
interface
IContext
{
...
...
@@ -54,30 +54,30 @@ export interface IContext {
asPath
?:
string
}
export
interface
IAppContext
<
R
extends
IRouterInterface
=
IRouterInterface
>
{
export
type
AppContextType
<
R
extends
BaseRouter
=
BaseRouter
>
=
{
Component
:
NextComponentType
<
IContext
>
router
:
R
ctx
:
IContext
ctx
:
IContext
,
}
export
interface
IAppInitialProps
{
pageProps
:
any
export
type
AppInitialProps
=
{
pageProps
:
any
,
}
export
interface
IAppProps
<
R
extends
IRouterInterface
=
IRouterInterface
>
extends
IAppInitialProps
{
export
type
AppPropsType
<
R
extends
BaseRouter
=
BaseRouter
>
=
AppInitialProps
&
{
Component
:
NextComponentType
<
IContext
>
router
:
R
router
:
R
,
}
export
interface
IDocumentContext
extends
IContext
{
renderPage
:
RenderPage
export
type
DocumentContext
=
IContext
&
{
renderPage
:
RenderPage
,
}
export
interface
IDocumentInitialProps
extends
RenderPageResult
{
styles
?:
React
.
ReactElement
[]
export
type
DocumentInitialProps
=
RenderPageResult
&
{
styles
?:
React
.
ReactElement
[]
,
}
export
interface
IDocumentProps
extends
IDocumentInitialProps
{
export
type
DocumentProps
=
DocumentInitialProps
&
{
__NEXT_DATA__
:
INEXTDATA
dangerousAsPath
:
string
ampPath
:
string
...
...
@@ -87,7 +87,7 @@ export interface IDocumentProps extends IDocumentInitialProps {
devFiles
:
string
[]
files
:
string
[]
dynamicImports
:
ManifestItem
[]
assetPrefix
?:
string
assetPrefix
?:
string
,
}
/**
...
...
@@ -123,7 +123,7 @@ export function isResSent(res: ServerResponse) {
return
res
.
finished
||
res
.
headersSent
}
export
async
function
loadGetInitialProps
<
C
extends
I
BaseContext
,
P
=
any
,
CP
=
{}
>
(
Component
:
NextComponentType
<
C
,
P
,
CP
>
,
ctx
:
C
):
Promise
<
P
|
null
>
{
export
async
function
loadGetInitialProps
<
C
extends
BaseContext
,
P
=
any
,
CP
=
{}
>
(
Component
:
NextComponentType
<
C
,
P
,
CP
>
,
ctx
:
C
):
Promise
<
P
|
null
>
{
if
(
process
.
env
.
NODE_ENV
!==
'production'
)
{
if
(
Component
.
prototype
&&
Component
.
prototype
.
getInitialProps
)
{
const
message
=
`"
${
getDisplayName
(
Component
)}
.getInitialProps()" is defined as an instance method - visit https://err.sh/zeit/next.js/get-initial-props-as-an-instance-method for more information.`
...
...
packages/next-server/server/render.tsx
View file @
b9638631
...
...
@@ -2,9 +2,9 @@ import { IncomingMessage, ServerResponse } from 'http'
import
{
ParsedUrlQuery
}
from
'querystring'
import
React
from
'react'
import
{
renderToString
,
renderToStaticMarkup
}
from
'react-dom/server'
import
{
IRouterInterface
}
from
'../lib/router/router'
import
{
BaseRouter
}
from
'../lib/router/router'
import
mitt
,
{
MittEmitter
}
from
'../lib/mitt'
;
import
{
loadGetInitialProps
,
isResSent
,
getDisplayName
,
ComponentsEnhancer
,
RenderPage
,
I
DocumentInitialProps
,
NextComponentType
,
DocumentType
,
AppType
}
from
'../lib/utils'
import
{
loadGetInitialProps
,
isResSent
,
getDisplayName
,
ComponentsEnhancer
,
RenderPage
,
DocumentInitialProps
,
NextComponentType
,
DocumentType
,
AppType
}
from
'../lib/utils'
import
Head
,
{
defaultHead
}
from
'../lib/head'
// @ts-ignore types will be added later as it's an internal module
import
Loadable
from
'../lib/loadable'
...
...
@@ -28,7 +28,7 @@ function noRouter() {
throw
new
Error
(
message
)
}
class
ServerRouter
implements
IRouterInterface
{
class
ServerRouter
implements
BaseRouter
{
route
:
string
pathname
:
string
query
:
string
...
...
@@ -160,7 +160,7 @@ function renderDocument(
}:
RenderOpts
&
{
dataManagerData
:
string
,
props
:
any
docProps
:
I
DocumentInitialProps
docProps
:
DocumentInitialProps
pathname
:
string
query
:
ParsedUrlQuery
dangerousAsPath
:
string
...
...
packages/next/client/router.ts
View file @
b9638631
/* global window */
import
React
from
'react'
import
Router
,
{
IRouterInterface
}
from
'next-server/dist/lib/router/router'
import
Router
,
{
BaseRouter
}
from
'next-server/dist/lib/router/router'
import
{
RouterContext
}
from
'next-server/dist/lib/router-context'
import
{
RequestContext
}
from
'next-server/dist/lib/request-context'
...
...
@@ -8,19 +8,19 @@ type ClassArguments<T> = T extends new(...args: infer U) => any ? U : any
type
RouterArgs
=
ClassArguments
<
typeof
Router
>
interface
ISingletonRouterBase
{
type
SingletonRouterBase
=
{
router
:
Router
|
null
readyCallbacks
:
Array
<
()
=>
any
>
ready
(
cb
:
()
=>
any
):
void
ready
(
cb
:
()
=>
any
):
void
,
}
export
interface
IPublicRouterInstance
extends
IRouterInterface
,
Pick
<
Router
,
|
'components'
|
'push'
|
'replace'
|
'reload'
|
'back'
|
'prefetch'
|
'beforePopState'
>
{
events
:
typeof
Router
[
'events'
]
export
type
PublicRouterInstance
=
BaseRouter
&
Pick
<
Router
,
|
'components'
|
'push'
|
'replace'
|
'reload'
|
'back'
|
'prefetch'
|
'beforePopState'
>
&
{
events
:
typeof
Router
[
'events'
]
,
}
export
interface
ISingletonRouter
extends
ISingletonRouterBase
,
IPublicRouterInstance
{}
export
type
SingletonRouter
=
SingletonRouterBase
&
PublicRouterInstance
const
SingletonRouter
:
I
SingletonRouterBase
=
{
const
singletonRouter
:
SingletonRouterBase
=
{
router
:
null
,
// holds the actual router instance
readyCallbacks
:
[],
ready
(
cb
:
()
=>
void
)
{
...
...
@@ -31,16 +31,14 @@ const SingletonRouter: ISingletonRouterBase = {
},
}
// const x = SingletonRouter as IRealRouter
// Create public properties and methods of the router in the SingletonRouter
// Create public properties and methods of the router in the singletonRouter
const
urlPropertyFields
=
[
'pathname'
,
'route'
,
'query'
,
'asPath'
]
const
propertyFields
=
[
'components'
]
const
routerEvents
=
[
'routeChangeStart'
,
'beforeHistoryChange'
,
'routeChangeComplete'
,
'routeChangeError'
,
'hashChangeStart'
,
'hashChangeComplete'
]
const
coreMethodFields
=
[
'push'
,
'replace'
,
'reload'
,
'back'
,
'prefetch'
,
'beforePopState'
]
// Events is a static property on the router, the router doesn't have to be initialized to use it
Object
.
defineProperty
(
S
ingletonRouter
,
'events'
,
{
Object
.
defineProperty
(
s
ingletonRouter
,
'events'
,
{
get
()
{
return
Router
.
events
},
...
...
@@ -51,7 +49,7 @@ propertyFields.concat(urlPropertyFields).forEach((field) => {
// the property assigned to the actual router
// The value might get changed as we change routes and this is the
// proper way to access it
Object
.
defineProperty
(
S
ingletonRouter
,
field
,
{
Object
.
defineProperty
(
s
ingletonRouter
,
field
,
{
get
()
{
const
router
=
getRouter
()
as
any
return
router
[
field
]
as
string
...
...
@@ -61,20 +59,20 @@ propertyFields.concat(urlPropertyFields).forEach((field) => {
coreMethodFields
.
forEach
((
field
)
=>
{
// We don't really know the types here, so we add them later instead
(
S
ingletonRouter
as
any
)[
field
]
=
(...
args
:
any
[])
=>
{
(
s
ingletonRouter
as
any
)[
field
]
=
(...
args
:
any
[])
=>
{
const
router
=
getRouter
()
as
any
return
router
[
field
](...
args
)
}
})
routerEvents
.
forEach
((
event
)
=>
{
S
ingletonRouter
.
ready
(()
=>
{
s
ingletonRouter
.
ready
(()
=>
{
Router
.
events
.
on
(
event
,
(...
args
)
=>
{
const
eventField
=
`on
${
event
.
charAt
(
0
).
toUpperCase
()}${
event
.
substring
(
1
)}
`
const
singletonRouter
=
S
ingletonRouter
as
any
if
(
singletonRouter
[
eventField
])
{
const
_singletonRouter
=
s
ingletonRouter
as
any
if
(
_
singletonRouter
[
eventField
])
{
try
{
singletonRouter
[
eventField
](...
args
)
_
singletonRouter
[
eventField
](...
args
)
}
catch
(
err
)
{
// tslint:disable-next-line:no-console
console
.
error
(
`Error when running the Router event:
${
eventField
}
`
)
...
...
@@ -87,16 +85,16 @@ routerEvents.forEach((event) => {
})
function
getRouter
()
{
if
(
!
S
ingletonRouter
.
router
)
{
if
(
!
s
ingletonRouter
.
router
)
{
const
message
=
'No router instance found.
\
n'
+
'You should only use "next/router" inside the client side of your app.
\
n'
throw
new
Error
(
message
)
}
return
S
ingletonRouter
.
router
return
s
ingletonRouter
.
router
}
// Export the
S
ingletonRouter and this is the public API.
export
default
SingletonRouter
as
I
SingletonRouter
// Export the
s
ingletonRouter and this is the public API.
export
default
singletonRouter
as
SingletonRouter
// Reexport the withRoute HOC
export
{
default
as
withRouter
}
from
'./with-router'
...
...
@@ -117,15 +115,15 @@ export function useRequest() {
// This is used in client side when we are initilizing the app.
// This should **not** use inside the server.
export
const
createRouter
=
(...
args
:
RouterArgs
)
=>
{
S
ingletonRouter
.
router
=
new
Router
(...
args
)
S
ingletonRouter
.
readyCallbacks
.
forEach
((
cb
)
=>
cb
())
S
ingletonRouter
.
readyCallbacks
=
[]
s
ingletonRouter
.
router
=
new
Router
(...
args
)
s
ingletonRouter
.
readyCallbacks
.
forEach
((
cb
)
=>
cb
())
s
ingletonRouter
.
readyCallbacks
=
[]
return
S
ingletonRouter
.
router
return
s
ingletonRouter
.
router
}
// This function is used to create the `withRouter` router instance
export
function
makePublicRouterInstance
(
router
:
Router
):
I
PublicRouterInstance
{
export
function
makePublicRouterInstance
(
router
:
Router
):
PublicRouterInstance
{
const
_router
=
router
as
any
const
instance
=
{}
as
any
...
...
packages/next/client/with-router.tsx
View file @
b9638631
import
React
from
'react'
import
PropTypes
from
'prop-types'
import
{
NextComponentType
,
IContext
}
from
'next-server/dist/lib/utils'
import
{
I
PublicRouterInstance
}
from
'./router'
;
import
{
PublicRouterInstance
}
from
'./router'
;
export
type
WithRouterProps
=
{
router
:
I
PublicRouterInstance
,
router
:
PublicRouterInstance
,
}
export
type
ExcludeRouterProps
<
P
>
=
Pick
<
P
,
Exclude
<
keyof
P
,
keyof
WithRouterProps
>>
...
...
packages/next/pages/_app.tsx
View file @
b9638631
import
React
,
{
ErrorInfo
}
from
'react'
import
PropTypes
from
'prop-types'
import
{
execOnce
,
loadGetInitialProps
,
NextComponentType
,
IContext
,
IAppContext
,
IAppInitialProps
,
IAppProps
}
from
'next-server/dist/lib/utils'
import
{
execOnce
,
loadGetInitialProps
,
NextComponentType
,
IContext
,
AppContextType
,
AppInitialProps
,
AppPropsType
}
from
'next-server/dist/lib/utils'
import
{
makePublicRouterInstance
}
from
'../client/router'
export
{
NextComponentType
,
IContext
,
IAppContext
,
IAppInitialProps
,
IApp
Props
}
export
{
NextComponentType
,
IContext
,
AppInitial
Props
}
type
Router
=
import
(
'next-server/dist/lib/router/router'
).
default
export
type
AppC
lientContext
=
IAppContext
<
Router
>
export
type
AppC
ontext
=
AppContextType
<
Router
>
export
type
AppProps
=
IAppProps
<
Router
>
export
type
AppProps
=
AppPropsType
<
Router
>
export
default
class
App
extends
React
.
Component
<
AppProps
>
{
static
childContextTypes
=
{
router
:
PropTypes
.
object
,
}
static
async
getInitialProps
({
Component
,
ctx
}:
AppC
lientContext
):
Promise
<
I
AppInitialProps
>
{
static
async
getInitialProps
({
Component
,
ctx
}:
AppC
ontext
):
Promise
<
AppInitialProps
>
{
const
pageProps
=
await
loadGetInitialProps
(
Component
,
ctx
)
return
{
pageProps
}
}
...
...
packages/next/pages/_document.tsx
View file @
b9638631
...
...
@@ -2,7 +2,7 @@
import
PropTypes
from
'prop-types'
import
React
,
{
Component
}
from
'react'
import
{
cleanAmpPath
}
from
'next-server/dist/server/utils'
import
{
IDocumentContext
,
IDocumentInitialProps
,
I
DocumentProps
}
from
'next-server/dist/lib/utils'
import
{
DocumentContext
,
DocumentInitialProps
,
DocumentProps
}
from
'next-server/dist/lib/utils'
import
{
htmlEscapeJsonString
}
from
'../server/htmlescape'
import
flush
from
'styled-jsx/server'
import
{
...
...
@@ -10,33 +10,33 @@ import {
CLIENT_STATIC_FILES_RUNTIME_WEBPACK
,
}
from
'next-server/constants'
export
{
IDocumentContext
,
IDocumentInitialProps
,
I
DocumentProps
}
export
{
DocumentContext
,
DocumentInitialProps
,
DocumentProps
}
export
interface
IOriginProps
{
export
type
OriginProps
=
{
nonce
?:
string
crossOrigin
?:
string
crossOrigin
?:
string
,
}
export
interface
IDocumentComponentContext
{
readonly
_documentProps
:
I
DocumentProps
readonly
_devOnlyInvalidateCacheQueryString
:
string
export
type
DocumentComponentContext
=
{
readonly
_documentProps
:
DocumentProps
readonly
_devOnlyInvalidateCacheQueryString
:
string
,
}
export
default
class
Document
extends
Component
<
I
DocumentProps
>
{
export
default
class
Document
extends
Component
<
DocumentProps
>
{
static
childContextTypes
=
{
_documentProps
:
PropTypes
.
any
,
_devOnlyInvalidateCacheQueryString
:
PropTypes
.
string
,
}
static
async
getInitialProps
({
renderPage
}:
IDocumentContext
):
Promise
<
I
DocumentInitialProps
>
{
static
async
getInitialProps
({
renderPage
}:
DocumentContext
):
Promise
<
DocumentInitialProps
>
{
const
{
html
,
head
,
dataOnly
}
=
await
renderPage
()
const
styles
=
flush
()
return
{
html
,
head
,
styles
,
dataOnly
}
}
context
!
:
I
DocumentComponentContext
context
!
:
DocumentComponentContext
getChildContext
():
I
DocumentComponentContext
{
getChildContext
():
DocumentComponentContext
{
return
{
_documentProps
:
this
.
props
,
// In dev we invalidate the cache by appending a timestamp to the resource URL.
...
...
@@ -69,7 +69,7 @@ export class Html extends Component {
children
:
PropTypes
.
node
.
isRequired
,
}
context
!
:
I
DocumentComponentContext
context
!
:
DocumentComponentContext
render
()
{
const
{
amphtml
}
=
this
.
context
.
_documentProps
...
...
@@ -79,7 +79,7 @@ export class Html extends Component {
}
}
export
class
Head
extends
Component
<
I
OriginProps
>
{
export
class
Head
extends
Component
<
OriginProps
>
{
static
contextTypes
=
{
_documentProps
:
PropTypes
.
any
,
_devOnlyInvalidateCacheQueryString
:
PropTypes
.
string
,
...
...
@@ -90,7 +90,7 @@ export class Head extends Component<IOriginProps> {
crossOrigin
:
PropTypes
.
string
,
}
context
!
:
I
DocumentComponentContext
context
!
:
DocumentComponentContext
getCssLinks
()
{
const
{
assetPrefix
,
files
}
=
this
.
context
.
_documentProps
...
...
@@ -343,7 +343,7 @@ export class Main extends Component {
_devOnlyInvalidateCacheQueryString
:
PropTypes
.
string
,
}
context
!
:
I
DocumentComponentContext
context
!
:
DocumentComponentContext
render
()
{
const
{
amphtml
,
html
}
=
this
.
context
.
_documentProps
...
...
@@ -352,7 +352,7 @@ export class Main extends Component {
}
}
export
class
NextScript
extends
Component
<
I
OriginProps
>
{
export
class
NextScript
extends
Component
<
OriginProps
>
{
static
contextTypes
=
{
_documentProps
:
PropTypes
.
any
,
_devOnlyInvalidateCacheQueryString
:
PropTypes
.
string
,
...
...
@@ -363,7 +363,7 @@ export class NextScript extends Component<IOriginProps> {
crossOrigin
:
PropTypes
.
string
,
}
context
!
:
I
DocumentComponentContext
context
!
:
DocumentComponentContext
getDynamicChunks
()
{
const
{
dynamicImports
,
assetPrefix
}
=
this
.
context
.
_documentProps
...
...
@@ -409,7 +409,7 @@ export class NextScript extends Component<IOriginProps> {
})
}
static
getInlineScriptSource
(
documentProps
:
I
DocumentProps
)
{
static
getInlineScriptSource
(
documentProps
:
DocumentProps
)
{
const
{
__NEXT_DATA__
}
=
documentProps
try
{
const
data
=
JSON
.
stringify
(
__NEXT_DATA__
)
...
...
packages/next/pages/_error.tsx
View file @
b9638631
...
...
@@ -9,11 +9,11 @@ const statusCodes: { [code: number]: string } = {
501
:
'Not Implemented'
,
}
export
interface
IErrorProps
{
statusCode
:
number
export
type
ErrorProps
=
{
statusCode
:
number
,
}
export
default
class
Error
<
P
=
{}
>
extends
React
.
Component
<
P
&
I
ErrorProps
>
{
export
default
class
Error
<
P
=
{}
>
extends
React
.
Component
<
P
&
ErrorProps
>
{
static
displayName
=
'ErrorPage'
static
getInitialProps
({
res
,
err
}:
IContext
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment