const { Component, pageProps}: { Component: NextApplicationPage; pageProps: any } = props
When I write the above code and set Component type to NextApplicationPage. I get an error saying, Cannot find name 'NextApplicationPage'
I have to use the above mentioned type for Component, because I have to access requireAuth
property from from Component
Please help
CodePudding user response:
You can extends the props of next:
import { AppProps } from "next/app"
import { NextPage } from "next"
...
export type NextApplicationPage<P = any, IP = P> = NextPage<P, IP> & {
requireAuth?: boolean
}
...
const { Component, pageProps }: { Component: NextApplicationPage; pageProps: any } = props as AppProps