Updated docs for getServerSideProps and getStaticProps return values#33577
Updated docs for getServerSideProps and getStaticProps return values#33577kodiakhq[bot] merged 6 commits intovercel:canaryfrom
Conversation
…based on the declared type (fix vercel#33576)
leerob
left a comment
There was a problem hiding this comment.
Would you mind updating getStaticPaths as well? Thank you!
@leerob getStaticPaths seems to be already in order based on its type. Can you elaborate more? |
|
It says "following required properties:" which I feel is misleading. "Any of the following" seems to make more sense, because there are multiple types of |
I think the |
Co-authored-by: Balázs Orbán <info@balazsorban.com>
There was a problem hiding this comment.
Left a comment on getStaticProps.
To clarify getStaticPaths, paths is always required, but fallback is optional and will default to fallback: false
I was wrong, both are actually required, you were right, so the getStaticPaths docs looks good.
next.js/packages/next/build/utils.ts
Lines 694 to 704 in 0fb1183
|
@balazsorban44 Updated the wording on |
This fixes the documentation for getServerSideProps and getStaticProps which mislead the defined type.
Current screenshot taken from nextjs doc
However, the declared type for these types are using union type which represents any of the following instead of optional.
Declared types;

GetStaticPropsResult
GetServerSidePropsResult

This PR updates the documentation for their return values;
Before: The
...function should return an object with the following optional properties:After: The
...function should return object with any one of the following properties:Bug
fixes #numbercontributing.mdFeature
fixes #numbercontributing.mdDocumentation / Examples
yarn lint