import { GetServerSideProps, GetStaticProps, PreviewData as NextPreviewData } from "next"; import { Infer, Struct } from "superstruct"; export type RouteDefinition = { path: string | Record; schema?: Struct | null; }; export type RoutesDefinition = Record>; export type QueryParams, Route extends keyof RouteList> = RouteList[Route]["schema"] extends null ? never : { [key in keyof Infer>]: string | string[] | undefined; }; export type UxfGetStaticProps, Route extends keyof RouteList, Props extends { [key: string]: any; } = { [key: string]: any; }, PreviewData extends NextPreviewData = NextPreviewData> = GetStaticProps, PreviewData>; export type UxfGetServerSideProps, Route extends keyof RouteList, Props extends { [key: string]: any; } = { [key: string]: any; }, PreviewData extends NextPreviewData = NextPreviewData> = GetServerSideProps, PreviewData>;