From 2533da289cccc8d18b3317e453006b499be78662 Mon Sep 17 00:00:00 2001 From: samueldusek Date: Tue, 5 Apr 2022 18:22:37 +0200 Subject: [PATCH 1/2] Docs: Add useful link to invalid-getstaticprops-value error message --- errors/invalid-getstaticprops-value.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/errors/invalid-getstaticprops-value.md b/errors/invalid-getstaticprops-value.md index 16fcf6a9df158..754e824c5275f 100644 --- a/errors/invalid-getstaticprops-value.md +++ b/errors/invalid-getstaticprops-value.md @@ -8,14 +8,16 @@ In one of the page's `getStaticProps` the return value had the incorrect shape. Make sure to return the following shape from `getStaticProps`: -```js +```ts export async function getStaticProps(ctx: { - params?: ParsedUrlQuery - preview?: boolean - previewData?: PreviewData + params?: ParsedUrlQuery; + preview?: boolean; + previewData?: PreviewData; }) { - return { props: { [key: string]: any } - } } ``` + +### Useful Links + +- [`getStaticProps` Documentation](https://nextjs.org/docs/api-reference/data-fetching/get-static-props) From 96ef1d3166303d48320555f27c28efeec1d6b8cc Mon Sep 17 00:00:00 2001 From: samueldusek Date: Tue, 5 Apr 2022 19:18:14 +0200 Subject: [PATCH 2/2] Fix: Add the return statement --- errors/invalid-getstaticprops-value.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/errors/invalid-getstaticprops-value.md b/errors/invalid-getstaticprops-value.md index 754e824c5275f..24a86c8498d24 100644 --- a/errors/invalid-getstaticprops-value.md +++ b/errors/invalid-getstaticprops-value.md @@ -14,7 +14,9 @@ export async function getStaticProps(ctx: { preview?: boolean; previewData?: PreviewData; }) { - props: { [key: string]: any } + return { + props: { [key: string]: any } + } } ```