feat(WEB-36): improve typings
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
export type HeaderProps = {
|
||||
pathname: string
|
||||
}
|
||||
pathname: string;
|
||||
};
|
||||
|
||||
@@ -8,7 +8,3 @@ export const langEnum = {
|
||||
};
|
||||
|
||||
export type Lang = keyof typeof langEnum;
|
||||
|
||||
export type LangProps<T = {}> = T & {
|
||||
lang: Lang
|
||||
}
|
||||
@@ -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>);
|
||||
|
||||
Reference in New Issue
Block a user