I am working with NextJS and need to extend their AppProps type with an optional parameter that I have added myself Layout. However the AppProps type is made up of many others e.g.
AppProps:
export declare type AppProps<P = {}> = AppPropsType<Router, P>;
AppPropsType:
export declare type AppPropsType<R extends NextRouter = NextRouter, P = {}> = AppInitialProps & {
Component: NextComponentType<NextPageContext, any, P>;
router: R;
__N_SSG?: boolean;
__N_SSP?: boolean;
};
NextComponentType:
export declare type NextComponentType<C extends BaseContext = NextPageContext, IP = {}, P = {}> = ComponentType<P> & {
/**
* Used for initial page load data population. Data returned from `getInitialProps` is serialized when server rendered.
* Make sure to return plain `Object` without using `Date`, `Map`, `Set`.
* @param ctx Context of `page`
*/
getInitialProps?(context: C): IP | Promise<IP>;
};
From my _app.tsx I want to be able to add Layout to Component with something like:
Component: {
Layout?: React.FunctionComponent;
};
Is there a way to do this from AppProps or would I need to extend/intersect AppPropsType first with Layout then redeclare my own AppProps which uses the extended AppPropsType?