@uxf/router 11.72.0 → 11.72.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/types.d.ts +5 -5
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { GetServerSideProps, GetStaticProps, PreviewData as NextPreviewData } from "next";
|
|
2
|
-
import { Struct } from "superstruct";
|
|
2
|
+
import { Infer, Struct } from "superstruct";
|
|
3
3
|
export type RoutesDefinition<Locales extends string[]> = Record<string, {
|
|
4
4
|
path: string | Record<Locales[number], string>;
|
|
5
5
|
schema?: Struct<any, any> | null;
|
|
6
6
|
}>;
|
|
7
|
-
export type QueryParams<RouteList
|
|
8
|
-
[key in keyof RouteList[Route]]: string | string[] | undefined;
|
|
7
|
+
export type QueryParams<RouteList extends RoutesDefinition<any>, Route extends keyof RouteList> = RouteList[Route]["schema"] extends null ? never : {
|
|
8
|
+
[key in keyof Infer<NonNullable<RouteList[Route]["schema"]>>]: string | string[] | undefined;
|
|
9
9
|
};
|
|
10
|
-
export type UxfGetStaticProps<RouteList
|
|
10
|
+
export type UxfGetStaticProps<RouteList extends RoutesDefinition<any>, Route extends keyof RouteList, Props extends {
|
|
11
11
|
[key: string]: any;
|
|
12
12
|
} = {
|
|
13
13
|
[key: string]: any;
|
|
14
14
|
}, PreviewData extends NextPreviewData = NextPreviewData> = GetStaticProps<Props, QueryParams<RouteList, Route>, PreviewData>;
|
|
15
|
-
export type UxfGetServerSideProps<RouteList
|
|
15
|
+
export type UxfGetServerSideProps<RouteList extends RoutesDefinition<any>, Route extends keyof RouteList, Props extends {
|
|
16
16
|
[key: string]: any;
|
|
17
17
|
} = {
|
|
18
18
|
[key: string]: any;
|