feat(WEB-36): improve typings

This commit is contained in:
Michael Zetterberg
2024-01-18 10:45:38 +01:00
parent 39b61c7691
commit 363580dac2
8 changed files with 35 additions and 18 deletions
+20 -3
View File
@@ -1,5 +1,22 @@
import { Lang } from "./lang";
import { Lang } from './lang';
export type Params<T = {}> = T & { params: { lang: Lang } };
export type SearchParams<S = {}> = {
searchParams: S & { [key: string]: string };
};
export type SearchParams<T = {}> = T & { searchParams: { [key: string]: string } };
export type Params<P = {}> = {
params: P;
};
export type LangParams = {
lang: Lang;
};
export type UriParams = {
uri?: string;
};
export type LayoutArgs<P = undefined> = P extends undefined ? {} : Params<P>;
export type PageArgs<P = undefined, S = undefined> = LayoutArgs<P> &
(S extends undefined ? {} : SearchParams<S>);