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
547bf460
Unverified
Commit
547bf460
authored
May 08, 2020
by
Justin
Committed by
GitHub
May 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Context types for getStaticProps and getServerSideProps (#12606)
parent
8d024554
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
index.d.ts
packages/next/types/index.d.ts
+17
-9
No files found.
packages/next/types/index.d.ts
View file @
547bf460
...
...
@@ -72,14 +72,18 @@ export {
NextApiHandler
,
}
export
type
GetStaticProps
<
P
extends
{
[
key
:
string
]:
any
}
=
{
[
key
:
string
]:
any
},
Q
extends
ParsedUrlQuery
=
ParsedUrlQuery
>
=
(
ctx
:
{
export
type
GetStaticPropsContext
<
Q
extends
ParsedUrlQuery
=
ParsedUrlQuery
>
=
{
params
?:
Q
preview
?:
boolean
previewData
?:
any
})
=>
Promise
<
{
}
export
type
GetStaticProps
<
P
extends
{
[
key
:
string
]:
any
}
=
{
[
key
:
string
]:
any
},
Q
extends
ParsedUrlQuery
=
ParsedUrlQuery
>
=
(
ctx
:
GetStaticPropsContext
<
Q
>
)
=>
Promise
<
{
props
:
P
unstable_revalidate
?:
number
|
boolean
}
>
...
...
@@ -91,16 +95,20 @@ export type GetStaticPaths<
fallback
:
boolean
}
>
export
type
GetServerSideProps
<
P
extends
{
[
key
:
string
]:
any
}
=
{
[
key
:
string
]:
any
},
export
type
GetServerSidePropsContext
<
Q
extends
ParsedUrlQuery
=
ParsedUrlQuery
>
=
(
context
:
{
>
=
{
req
:
IncomingMessage
res
:
ServerResponse
params
?:
Q
query
:
ParsedUrlQuery
preview
?:
boolean
previewData
?:
any
})
=>
Promise
<
{
props
:
P
}
>
}
export
type
GetServerSideProps
<
P
extends
{
[
key
:
string
]:
any
}
=
{
[
key
:
string
]:
any
},
Q
extends
ParsedUrlQuery
=
ParsedUrlQuery
>
=
(
context
:
GetServerSidePropsContext
<
Q
>
)
=>
Promise
<
{
props
:
P
}
>
export
default
next
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