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
55e87ea5
Commit
55e87ea5
authored
Jul 25, 2019
by
Adam Misiorny
Committed by
Luis Fernando Alvarez D
Jul 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve types (#8097)
parent
427a02a4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
3 deletions
+5
-3
utils.ts
packages/next-server/lib/utils.ts
+1
-1
router.ts
packages/next/client/router.ts
+1
-1
index.d.ts
packages/next/types/index.d.ts
+3
-1
No files found.
packages/next-server/lib/utils.ts
View file @
55e87ea5
...
@@ -215,7 +215,7 @@ export async function loadGetInitialProps<
...
@@ -215,7 +215,7 @@ export async function loadGetInitialProps<
C
extends
BaseContext
,
C
extends
BaseContext
,
IP
=
{},
IP
=
{},
P
=
{}
P
=
{}
>
(
Component
:
NextComponentType
<
C
,
IP
,
P
>
,
ctx
:
C
):
Promise
<
IP
|
null
>
{
>
(
Component
:
NextComponentType
<
C
,
IP
,
P
>
,
ctx
:
C
):
Promise
<
IP
>
{
if
(
process
.
env
.
NODE_ENV
!==
'production'
)
{
if
(
process
.
env
.
NODE_ENV
!==
'production'
)
{
if
(
Component
.
prototype
&&
Component
.
prototype
.
getInitialProps
)
{
if
(
Component
.
prototype
&&
Component
.
prototype
.
getInitialProps
)
{
const
message
=
`"
${
getDisplayName
(
const
message
=
`"
${
getDisplayName
(
...
...
packages/next/client/router.ts
View file @
55e87ea5
...
@@ -112,7 +112,7 @@ function getRouter() {
...
@@ -112,7 +112,7 @@ function getRouter() {
export
default
singletonRouter
as
SingletonRouter
export
default
singletonRouter
as
SingletonRouter
// Reexport the withRoute HOC
// Reexport the withRoute HOC
export
{
default
as
withRouter
}
from
'./with-router'
export
{
default
as
withRouter
,
WithRouterProps
}
from
'./with-router'
export
function
useRouter
()
{
export
function
useRouter
()
{
return
React
.
useContext
(
RouterContext
)
return
React
.
useContext
(
RouterContext
)
...
...
packages/next/types/index.d.ts
View file @
55e87ea5
...
@@ -38,7 +38,9 @@ declare module 'react' {
...
@@ -38,7 +38,9 @@ declare module 'react' {
* `Page` type, use it as a guide to create `pages`.
* `Page` type, use it as a guide to create `pages`.
*/
*/
export
type
NextPage
<
P
=
{},
IP
=
P
>
=
{
export
type
NextPage
<
P
=
{},
IP
=
P
>
=
{
(
props
:
P
):
JSX
.
Element
(
props
:
P
):
JSX
.
Element
|
null
defaultProps
?:
Partial
<
P
>
displayName
?:
string
/**
/**
* Used for initial page load data population. Data returned from `getInitialProps` is serialized when server rendered.
* Used for initial page load data population. Data returned from `getInitialProps` is serialized when server rendered.
* Make sure to return plain `Object` without using `Date`, `Map`, `Set`.
* Make sure to return plain `Object` without using `Date`, `Map`, `Set`.
...
...
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