File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,17 +25,14 @@ import { withPageAuthRequired as withPageAuthRequiredCSR } from '../frontend';
2525 *
2626 * @category Server
2727 */
28- export type GetServerSidePropsResultWithSession = GetServerSidePropsResult < {
29- user ?: Claims | null ;
30- [ key : string ] : any ;
31- } > ;
28+ export type GetServerSidePropsResultWithSession < P = any > = GetServerSidePropsResult < P & { user ?: Claims | null } > ;
3229
3330/**
3431 * A page route that has been augmented with {@link WithPageAuthRequired}
3532 *
3633 * @category Server
3734 */
38- export type PageRoute = ( cts : GetServerSidePropsContext ) => Promise < GetServerSidePropsResultWithSession > ;
35+ export type PageRoute < P > = ( cts : GetServerSidePropsContext ) => Promise < GetServerSidePropsResultWithSession < P > > ;
3936
4037/**
4138 * If you have a custom returnTo url you should specify it in `returnTo`.
@@ -63,7 +60,10 @@ export type PageRoute = (cts: GetServerSidePropsContext) => Promise<GetServerSid
6360 *
6461 * @category Server
6562 */
66- export type WithPageAuthRequiredOptions = { getServerSideProps ?: GetServerSideProps ; returnTo ?: string } ;
63+ export type WithPageAuthRequiredOptions < P = any > = {
64+ getServerSideProps ?: GetServerSideProps < P > ;
65+ returnTo ?: string ;
66+ } ;
6767
6868/**
6969 * Wrap your `getServerSideProps` with this method to make sure the user is authenticated before visiting the page.
@@ -85,7 +85,7 @@ export type WithPageAuthRequiredOptions = { getServerSideProps?: GetServerSidePr
8585 * @category Server
8686 */
8787export type WithPageAuthRequired = {
88- ( opts ?: WithPageAuthRequiredOptions ) : PageRoute ;
88+ < P > ( opts ?: WithPageAuthRequiredOptions < P > ) : PageRoute < P > ;
8989 < P extends WithPageAuthRequiredProps > (
9090 Component : ComponentType < P > ,
9191 options ?: WithPageAuthRequiredCSROptions
You can’t perform that action at this time.
0 commit comments