Skip to content

fix(types): apply AppType's generic parameter to props, not pageProps - #97202

Open
gee-46 wants to merge 1 commit into
vercel:canaryfrom
gee-46:fix/apptype-props-typing
Open

fix(types): apply AppType's generic parameter to props, not pageProps#97202
gee-46 wants to merge 1 commit into
vercel:canaryfrom
gee-46:fix/apptype-props-typing

Conversation

@gee-46

@gee-46 gee-46 commented Aug 11, 2026

Copy link
Copy Markdown

Fixes #42846

What: AppType

's generic parameter P was substituted into the pageProps slot of the component's props instead of being merged onto the top-level props.

Why: Custom fields returned alongside pageProps from a custom App.getInitialProps weren't reflected correctly — real top-level props threw false type errors, and nonexistent pageProps fields showed no error. Repro: https://codesandbox.io/s/polished-tree-xhvisb

How: Changed the third generic argument from AppPropsType<any, P> to P & AppPropsType<any, any> so P merges directly onto the component's props.

Fixes vercel#42846

What: AppType<P>'s generic parameter P was substituted into the pageProps slot of the component's props instead of being merged onto the top-level props.

Why: Custom fields returned alongside pageProps from a custom App.getInitialProps weren't reflected correctly — real top-level props threw false type errors, and nonexistent pageProps fields showed no error. Repro: https://codesandbox.io/s/polished-tree-xhvisb

How: Changed the third generic argument from AppPropsType<any, P> to P & AppPropsType<any, any> so P merges directly onto the component's props.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parameter on AppType is used incorrectly

1 participant