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

View File

@@ -1,3 +1,3 @@
export type HeaderProps = {
pathname: string
}
pathname: string;
};

View File

@@ -8,7 +8,3 @@ export const langEnum = {
};
export type Lang = keyof typeof langEnum;
export type LangProps<T = {}> = T & {
lang: Lang
}

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>);