Open tomdohnal opened 4 years ago
Adding on to this bug as I think the following is similar-enough to tackle in the same issue....
InferGetStaticPropsType will also fail when consider conditional returns from getStaticProps, like a notFound
response.
never
with a notFound
condition is presentnotFound
conditionLooks like this will hopefully be solved with Typescript 4.9!
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: