next.js icon indicating copy to clipboard operation
next.js copied to clipboard

fix: correct AppType parameter usage for TypeScript

Open harikapadia999 opened this issue 2 weeks ago • 1 comments

Description

Fixes #42846

The AppType generic parameter P was incorrectly used as InitialProps instead of PageProps. This fix properly uses AppInitialProps<PageProps> for the InitialProps parameter to match the actual structure where pageProps is wrapped in an object.

Changes

Before:

export type AppType<P = {}> = NextComponentType<
  AppContextType,
  P,
  AppPropsType<any, P>
>

After:

export type AppType<PageProps = {}> = NextComponentType<
  AppContextType,
  AppInitialProps<PageProps>,
  AppPropsType<any, PageProps>
>

Why This Fix?

According to NextComponentType definition:

  • 1st param: Context
  • 2nd param: InitialProps (should be AppInitialProps<PageProps>)
  • 3rd param: Props (already correctly using AppPropsType<any, PageProps>)

The parameter name is also changed from P to PageProps for clarity.

Testing

  • TypeScript compilation passes
  • Type definitions now correctly reflect the actual structure

harikapadia999 avatar Dec 08 '25 11:12 harikapadia999

Allow CI Workflow Run

  • [ ] approve CI run for commit: e32c0607413506c7a272438c7dbc080939016a7f

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

nextjs-bot avatar Dec 08 '25 11:12 nextjs-bot