]> Untitled Git - lemmy-ui.git/blobdiff - src/shared/utils.ts
Refactor route data
[lemmy-ui.git] / src / shared / utils.ts
index 5648df00b93ab06fec3f124c9ac0c506adfc9a28..fe83977db598e8921cddd7126cd1e92a2db34ef7 100644 (file)
@@ -1262,7 +1262,7 @@ export function isBrowser() {
   return typeof window !== "undefined";
 }
 
-export function setIsoData(context: any): IsoData {
+export function setIsoData<T extends object>(context: any): IsoData<T> {
   // If its the browser, you need to deserialize the data from the window
   if (isBrowser()) {
     return window.isoData;
@@ -1557,6 +1557,10 @@ export type QueryParams<T extends Record<string, any>> = {
   [key in keyof T]?: string;
 };
 
+export type WithPromiseKeys<T extends object> = {
+  [K in keyof T]: Promise<T[K]>;
+};
+
 export function getQueryParams<T extends Record<string, any>>(processors: {
   [K in keyof T]: (param: string) => T[K];
 }): T {