Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/server/helpers/with-page-auth-required.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ describe("with-page-auth-required ssr", () => {
Promise.resolve(React.createElement("div", {}, "foo"))
);
const res = await handler({});
expect(ReactDOMServer.renderToString(res)).toBe("<div>foo</div>");
expect(ReactDOMServer.renderToString(res as React.ReactElement)).toBe(
"<div>foo</div>"
);
expect(auth0Client.getSession).toHaveBeenCalledTimes(1);
});

Expand Down
4 changes: 2 additions & 2 deletions src/server/helpers/with-page-auth-required.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { ParsedUrlQuery } from "querystring";
import type React from "react";
import {
GetServerSideProps,
GetServerSidePropsContext,
Expand Down Expand Up @@ -44,10 +43,11 @@ export type AppRouterPageRouteOpts = {

/**
* An app route that has been augmented with {@link WithPageAuthRequired}.
* Returns unknown to avoid React dependency while maintaining type safety.
*/
export type AppRouterPageRoute = (
obj: AppRouterPageRouteOpts
) => Promise<React.JSX.Element>;
) => Promise<unknown>;

/**
* If you have a custom returnTo url you should specify it in `returnTo`.
Expand Down