Correct type inference when using fallback: true
#18705
Labels
TypeScript
Related to types with Next.js.
Milestone
fallback: true
#18705
Feature request
Is your feature request related to a problem? Please describe.
When I'm using
fallback: true
ingetStaticPaths
and usingInferGetStaticPropsType
to infer the props, it doesn't take the fact that the fallback page might load into account. It assumes that the props will always get passed to the page.Describe the solution you'd like
I'd like to have the possibility to pass the getStaticPaths as a second argument to the
InferGetStaticPropsType
type like this:The
InferGetStaticPropsType
type would infer if the props can be an empty object based upon the value offallback
returned from getStaticPaths.Describe alternatives you've considered
An alternative is to type the props manually if using
fallback: true
like this:The text was updated successfully, but these errors were encountered: