@theguild/components
Version:
22 lines (20 loc) • 801 B
text/typescript
/**
* Next.js page props type.
* @see https://nextjs.org/docs/app/api-reference/file-conventions/page#props
* @see https://nextjs.org/docs/app/building-your-application/routing/dynamic-routes#good-to-know
*/
interface NextPageProps<TParams extends string = never, TSearchParams extends string = never> {
params: Promise<UnionToIntersection<{
[K in TParams]: {
[F in K extends `...${infer U}` ? U : K]: K extends `...${string}` ? string[] : string;
};
}[TParams]>>;
searchParams: Promise<{
[K in TSearchParams]?: string | string[];
}>;
}
type Prettify<T> = {
[K in keyof T]: T[K];
} & {};
type UnionToIntersection<T> = Prettify<(T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never>;
export type { NextPageProps };