rsnext/errors/invalid-getstaticprops-value.md
tarunama 7fd5a24d94
feat: add type to previewData (#21574)
`previewData` was already [typed declare variable](https://github.com/vercel/next.js/compare/canary...tarunama:feature/remove-any1?expand=1#diff-bd7baf53ff559d84461af8b2fd62cade7e2d8eb203f489e24a27c5b83a79a9d3L1380).
So I have defined `PreviewData` type, and adapt for avoiding error by type safe.
2021-04-20 18:13:48 +00:00

428 B

Invalid getStaticProps Return Value

Why This Error Occurred

In one of the page's getStaticProps the return value had the incorrect shape.

Possible Ways to Fix It

Make sure to return the following shape from getStaticProps:

export async function getStaticProps(ctx: {
  params?: ParsedUrlQuery
  preview?: boolean
  previewData?: PreviewData
}) {
  return {
    props: { [key: string]: any }
  }
}