Last active
September 1, 2021 21:56
-
-
Save fostyfost/387eaa433fa1beb9b20409470a2f66c2 to your computer and use it in GitHub Desktop.
Next.js: `InferGetStaticParams` and `InferGetServerSideParams`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type InferGetStaticPropsQueryType<Fn> = Fn extends GetStaticProps<any, infer Query> | |
? Query | |
: Fn extends ( | |
context?: GetStaticPropsContext<infer Query>, | |
) => Promise<GetStaticPropsResult<any>> | GetStaticPropsResult<any> | |
? Query | |
: never | |
export type InferGetServerSidePropsQueryType<Fn> = Fn extends GetServerSideProps<any, infer Query> | |
? Query | |
: Fn extends (context?: GetServerSidePropsContext<infer Query>) => Promise<GetServerSidePropsResult<any>> | |
? Query | |
: never |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment