From 739e6f076096ea011d1dcc106fe93336755c8df8 Mon Sep 17 00:00:00 2001 From: Samuel <86006376+samueldusek@users.noreply.github.com> Date: Tue, 5 Apr 2022 20:59:58 +0200 Subject: [PATCH] Docs: Add useful link to invalid-getstaticprops-value error message (#35915) ## Documentation / Examples - [x] Make sure the linting passes by running `yarn lint` I would like to add useful link to `getStaticProps` invalid return value error message as currently there is no useful link being provided. I believe that this might improve the developer experience. --- errors/invalid-getstaticprops-value.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/errors/invalid-getstaticprops-value.md b/errors/invalid-getstaticprops-value.md index 16fcf6a9df15875..24a86c8498d24b7 100644 --- a/errors/invalid-getstaticprops-value.md +++ b/errors/invalid-getstaticprops-value.md @@ -8,14 +8,18 @@ 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 } - } + return { + props: { [key: string]: any } + } } ``` + +### Useful Links + +- [`getStaticProps` Documentation](https://nextjs.org/docs/api-reference/data-fetching/get-static-props)