# withPageAuthRequired fails type check with typed props

**URL:** <https://community.auth0.com/t/withpageauthrequired-fails-type-check-with-typed-props/75165>\
**Category:** Get Help\
**Tags:** nextjs\
**Created:** [December 18, 2021, 10:25pm UTC](https://community.auth0.com/t/withpageauthrequired-fails-type-check-with-typed-props/75165 "2021-12-18T22:25:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marinko](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marinko/32/33197_2.png) [@marinko](https://community.auth0.com/u/marinko)\
**Post date:** [December 18, 2021, 10:25pm UTC](https://community.auth0.com/t/withpageauthrequired-fails-type-check-with-typed-props/75165/1 "2021-12-18T22:25:05Z")

</div>

Hi.

I am working on nextjs app and I have a NextPage component that receives props from getStaticProps function. The component is wrapped inside the _withPageAuthRequired()_ call. My build fails with the following error:

```auto
Type error: No overload matches this call.
  Overload 1 of 2, '(opts?: WithPageAuthRequiredOptions<unknown> | undefined): PageRoute<unknown>', gave the following error.
    Type '({ deals }: { deals: DealResponse[]; }) => Element' has no properties in common with type 'WithPageAuthRequiredOptions<unknown>'.
  Overload 2 of 2, '(Component: ComponentType<WithPageAuthRequiredProps>, options?: WithPageAuthRequiredOptions | undefined): FC<...>', gave the following error.
    Argument of type '({ deals }: { deals: DealResponse[]; }) => Element' is not assignable to parameter of type 'ComponentType<WithPageAuthRequiredProps>'.
      Type '({ deals }: { deals: DealResponse[]; }) => Element' is not assignable to type 'FunctionComponent<WithPageAuthRequiredProps>'.
        Types of parameters '__0' and 'props' are incompatible.
          Property 'deals' is missing in type 'PropsWithChildren<WithPageAuthRequiredProps>' but required in type '{ deals: DealResponse[]; }'.

  89 | };

```

It works as long as props don’t have a type but I need my props typed. How can I make this work?

UPDATE: I managed to work around it by casting the component to any type like `export default withPageAuthRequired(History as any);`. It would be cool to find another way of making it work though.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 20, 2021, 1:12pm UTC](https://community.auth0.com/t/withpageauthrequired-fails-type-check-with-typed-props/75165/2 "2021-12-20T13:12:35Z")

</div>

Sharing your workaround as a temporary solution for now:

UPDATE: I managed to work around it by casting the component to any type like `export default withPageAuthRequired(History as any);` . It would be cool to find another way of making it work though.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [January 4, 2022, 1:12pm UTC](https://community.auth0.com/t/withpageauthrequired-fails-type-check-with-typed-props/75165/3 "2022-01-04T13:12:55Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
