diff --git a/packages/next/types/index.d.ts b/packages/next/types/index.d.ts index 25b63fe2553316..e679a2989cc58b 100644 --- a/packages/next/types/index.d.ts +++ b/packages/next/types/index.d.ts @@ -125,12 +125,8 @@ export type GetStaticProps< context: GetStaticPropsContext ) => Promise> | GetStaticPropsResult

-export type InferGetStaticPropsType = T extends GetStaticProps - ? P - : T extends ( - context?: GetStaticPropsContext - ) => Promise> | GetStaticPropsResult - ? P +export type InferGetStaticPropsType = T extends GetStaticProps + ? Extract>, { props: any }>['props'] : never export type GetStaticPathsContext = { @@ -178,15 +174,10 @@ export type GetServerSideProps< context: GetServerSidePropsContext ) => Promise> -export type InferGetServerSidePropsType = T extends GetServerSideProps< - infer P, - any -> - ? P - : T extends ( - context?: GetServerSidePropsContext - ) => Promise> - ? P +type Filter = T extends U ? T : never + +export type InferGetServerSidePropsType = T extends GetServerSideProps + ? Extract>, { props: any }>['props'] : never declare global {