@open-condo/miniapp-utils
Version:
A set of helper functions / components / hooks used to build new condo apps fast
23 lines (20 loc) • 697 B
text/typescript
import { IncomingMessage, ServerResponse } from 'http';
import { ComponentType } from 'react';
type Optional<T> = T | undefined;
type AppInitialProps<PropsType extends Record<string, unknown>> = {
pageProps: PropsType;
};
type AppContext = {
ctx: {
req: Optional<IncomingMessage>;
res: Optional<ServerResponse>;
};
};
type AppType<PropsType extends Record<string, unknown>, ComponentType, RouterType> = ComponentType<{
pageProps: PropsType;
Component: ComponentType;
router: RouterType;
}> & {
getInitialProps?: (context: AppContext) => Promise<AppInitialProps<PropsType>> | AppInitialProps<PropsType>;
};
export type { AppType as A, Optional as O };