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
5dae98ea
Unverified
Commit
5dae98ea
authored
Mar 07, 2023
by
Shu Ding
Committed by
GitHub
Mar 07, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more JSDoc to types (#46897)
Fixes NEXT-540.
parent
422b3b01
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
4 deletions
+75
-4
config-shared.ts
packages/next/src/server/config-shared.ts
+23
-4
index.d.ts
packages/next/types/index.d.ts
+52
-0
No files found.
packages/next/src/server/config-shared.ts
View file @
5dae98ea
...
...
@@ -144,6 +144,10 @@ export interface ExperimentalConfig {
nextScriptWorkers
?:
boolean
scrollRestoration
?:
boolean
externalDir
?:
boolean
/**
* The App Router (app directory) enables support for layouts, Server Components, streaming, and colocated data fetching.
* @see https://beta.nextjs.org/docs/api-reference/next.config.js#appdir
*/
appDir
?:
boolean
amp
?:
{
optimizer
?:
any
...
...
@@ -184,7 +188,10 @@ export interface ExperimentalConfig {
adjustFontFallbacks
?:
boolean
adjustFontFallbacksWithSizeAdjust
?:
boolean
// A list of packages that should be treated as external in the RSC server build
/**
* A list of packages that should be treated as external in the RSC server build.
* @see https://beta.nextjs.org/docs/api-reference/next.config.js#servercomponentsexternalpackages
*/
serverComponentsExternalPackages
?:
string
[]
fontLoaders
?:
Array
<
{
loader
:
string
;
options
?:
any
}
>
...
...
@@ -209,10 +216,18 @@ export interface ExperimentalConfig {
/** in `MB` */
memoryLimit
?:
number
}
/**
* For use with `@next/mdx`. Compile MDX files using the new Rust compiler.
* @see https://beta.nextjs.org/docs/api-reference/next.config.js#mdxrs
*/
mdxRs
?:
boolean
// Generate Route types and enable type checking for Link and Router.push, etc.
// This option requires `appDir` to be enabled first.
/**
* Generate Route types and enable type checking for Link and Router.push, etc.
* This option requires `appDir` to be enabled first.
* @see https://beta.nextjs.org/docs/api-reference/next.config.js#typedroutes
*/
typedRoutes
?:
boolean
/**
...
...
@@ -554,7 +569,11 @@ export interface NextConfig extends Record<string, any> {
*/
output
?:
'standalone'
|
'export'
// A list of packages that should always be transpiled and bundled in the server
/**
* Automatically transpile and bundle dependencies from local packages (like monorepos) or from external dependencies (`node_modules`). This replaces the
* `next-transpile-modules` package.
* @see [transpilePackages](https://beta.nextjs.org/docs/api-reference/next.config.js#transpilepackages)
*/
transpilePackages
?:
string
[]
skipMiddlewareUrlNormalize
?:
boolean
...
...
packages/next/types/index.d.ts
View file @
5dae98ea
...
...
@@ -138,6 +138,10 @@ export {
export
type
PreviewData
=
string
|
false
|
object
|
undefined
/**
* Context object passed into `getStaticProps`.
* @link https://nextjs.org/docs/api-reference/data-fetching/get-static-props#context-parameter
*/
export
type
GetStaticPropsContext
<
Params
extends
ParsedUrlQuery
=
ParsedUrlQuery
,
Preview
extends
PreviewData
=
PreviewData
...
...
@@ -150,11 +154,26 @@ export type GetStaticPropsContext<
defaultLocale
?:
string
}
/**
* The return type of `getStaticProps`.
* @link https://nextjs.org/docs/api-reference/data-fetching/get-static-props#getstaticprops-return-values
*/
export
type
GetStaticPropsResult
<
Props
>
=
|
{
props
:
Props
;
revalidate
?:
number
|
boolean
}
|
{
redirect
:
Redirect
;
revalidate
?:
number
|
boolean
}
|
{
notFound
:
true
;
revalidate
?:
number
|
boolean
}
/**
* Static Site Generation feature for Next.js.
* @link https://nextjs.org/docs/basic-features/data-fetching/get-static-props
* @link https://nextjs.org/docs/basic-features/typescript#static-generation-and-server-side-rendering
* @example
* ```ts
* export const getStaticProps: GetStaticProps = async (context) => {
* // ...
* }
* ```
*/
export
type
GetStaticProps
<
Props
extends
{
[
key
:
string
]:
any
}
=
{
[
key
:
string
]:
any
},
Params
extends
ParsedUrlQuery
=
ParsedUrlQuery
,
...
...
@@ -173,6 +192,10 @@ export type GetStaticPathsContext = {
defaultLocale
?:
string
}
/**
* The return type of `getStaticPaths`.
* @link https://nextjs.org/docs/api-reference/data-fetching/get-static-paths#getstaticpaths-return-values
*/
export
type
GetStaticPathsResult
<
Params
extends
ParsedUrlQuery
=
ParsedUrlQuery
>
=
{
...
...
@@ -180,10 +203,25 @@ export type GetStaticPathsResult<
fallback
:
boolean
|
'blocking'
}
/**
* Define a list of paths to be statically generated if dynamic routes exist.
* @link https://nextjs.org/docs/basic-features/data-fetching/get-static-paths
* @link https://nextjs.org/docs/basic-features/typescript#static-generation-and-server-side-rendering
* @example
* ```ts
* export const getStaticPaths: GetStaticPaths = async () => {
* // ...
* }
* ```
*/
export
type
GetStaticPaths
<
Params
extends
ParsedUrlQuery
=
ParsedUrlQuery
>
=
(
context
:
GetStaticPathsContext
)
=>
Promise
<
GetStaticPathsResult
<
Params
>>
|
GetStaticPathsResult
<
Params
>
/**
* Context object passed into `getServerSideProps`.
* @link https://nextjs.org/docs/api-reference/data-fetching/get-server-side-props#context-parameter
*/
export
type
GetServerSidePropsContext
<
Params
extends
ParsedUrlQuery
=
ParsedUrlQuery
,
Preview
extends
PreviewData
=
PreviewData
...
...
@@ -202,11 +240,25 @@ export type GetServerSidePropsContext<
defaultLocale
?:
string
}
/**
* The return type of `getServerSideProps`.
* @link https://nextjs.org/docs/api-reference/data-fetching/get-server-side-props#getserversideprops-return-values
*/
export
type
GetServerSidePropsResult
<
Props
>
=
|
{
props
:
Props
|
Promise
<
Props
>
}
|
{
redirect
:
Redirect
}
|
{
notFound
:
true
}
/**
* Server-side Rendering feature for Next.js.
* @link https://nextjs.org/docs/basic-features/data-fetching/get-server-side-props
* @link https://nextjs.org/docs/basic-features/typescript#static-generation-and-server-side-rendering
* @example
* ```ts
* export const getServerSideProps: GetServerSideProps = async (context) => {
* // ...
* }
*/
export
type
GetServerSideProps
<
Props
extends
{
[
key
:
string
]:
any
}
=
{
[
key
:
string
]:
any
},
Params
extends
ParsedUrlQuery
=
ParsedUrlQuery
,
...
...
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