Skip to content
This repository was archived by the owner on Apr 15, 2021. It is now read-only.
This repository was archived by the owner on Apr 15, 2021. It is now read-only.

Static Pre-rendering types inconsistency #109

Open
@bespoyasov

Description

@bespoyasov

Hey!

I think I found an error in Static Prerendering docs.

There is an example of using an async function as a pre-render request function in docs:

module.exports = new Router().prerender(async () => {
  const paths = await fetchCategoryPathsFromAPI()
  return paths.map(path => ({ path }))
})

However, TS won't let me compile this code since:
«Screenshot» 2020-12-01 at 10 08 41

The same goes for the Next.js example:

«Screenshot» 2020-12-01 at 10 07 19

The only workaround I found is to make any request function async and use an array of them as an argument for prerender():
«Screenshot» 2020-12-01 at 10 08 55

Is this intentional?
If so, I can create a PR to update docs for this page.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions